post - Filter results with Jquery -


I have created a search form for a script in php. I basically have some checkboxes and submit buttons in this form. Each checkbox is a category, if I look at one or more checkboxes, the result is filtered by thoose categories.

Here is the html code:

   

I am trying to get results inline with AJAX, for most parts of my script, I use JQuery to make any person $ _POST data via AGx Passing in realtime, can help me find out without reloading the page?

p.s I am sorry for my poor English, I hope I was quite clear: |

The ID should be unique, the form only concerns about names.

  & lt; Html & gt; & Lt; Top & gt; & Lt; Script type = "text / javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {$ ('# submitbutton') Click (function () {var catArray = new Array (); var j = 0; for (var i = 0; i & lt; 3 ; I ++) {if (document.myForm.categories [i] .checked == 1) {catArray [j] = document.myForm.categories [i] .value; j ++;}} // just get it here Keep the output so that you can see the output / alerts ('array:' + cat era.Tosting ()); $ .azax ({type: "post", url: "search.fp", data: ({categories: catarera.tustin ()}), Success: function (msg) {$ ('# search_results') .HTML (msg);}}); return;});}); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Form name = "myForm" onsubmit = "return false" & gt; Category 1 & lt; Input type = "checkbox" name = "categories" id = "category1" value = "1" /> Category 2 & lt; Input type = "checkbox" name = "categories" id = "category2" value = "2" /> Category 3 & lt; Input type = "checkbox" name = "categories" id = "category3" value = "3" /> & Lt; Button ID = "Submit Button" & gt; Submit & lt; / Button & gt; & Lt; / Form & gt; & Lt; Div id = "search_results" & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -