0

I currently have a working function to pass the information from check boxes to the URL as below:

jQuery

$('input[type="checkbox"]').on('change', function(e){
    var data = $('input[type="checkbox"]').serialize(),
        loc = $('<a>', {href:window.location})[0];
    $.post('/ajax-post-url/', data);
    if(history.pushState){
        history.pushState(null, null, loc.pathname+'?'+data);
    }
});

HTML

<div class="panel-body">
            <div class="rowElem">
              <input type="checkbox" name="chbox" id="" value="red">
              <label>Color #1</label>
            </div>
            <div class="rowElem">
              <input type="checkbox" name="chbox" id="" value="green">
              <label>Color #2</label>
            </div>
            <div class="rowElem">
              <input type="checkbox" name="chbox" id="" value="blue">
              <label>Color #3</label>
            </div>
            <a href="pagetwo" class="linkBtn">Go to page two</a>
</div>

Result:

http://www.someurl.com/pageone?chbox=red&chbox=green&chbox=blue

My question is when I click on ".linkBtn" how can I pass the information after "?" in the URL to "pagetwo" (or any page) so the result would be:

http://www.someurl.com/pagetwo?chbox=red&chbox=green&chbox=blue

I'm planning on using the information in the URL to add classes on elements on the next page.

Thanks

webmonkey237
  • 355
  • 1
  • 3
  • 19

1 Answers1

0

Found my answers here: http://www.aspsnippets.com/Articles/Send-Pass-Data-Values-from-one-page-to-another-using-jQuery.aspx Also has an example of using a cookie rather than passing information through the URL

webmonkey237
  • 355
  • 1
  • 3
  • 19