lundi 21 août 2017

How to build a filter using php and ajax (checkboxes)

recently i have build a selectboxes filter (filter data from mysql)with the help of stackoverflow forum.I was wondering that how can i build a filter using checkboxes instead selectboxes. here is my html

Filter by Location
<input type="checkbox" id="calangute" name="calangute" />
        <label for="calangute"> Calangute</label><br>
        <input type="checkbox" id="baga" name="baga">
        <label for="baga"> Baga</label><br>
        <input type="checkbox" id="morjim" name="morjim">
        <label for="morjim"> Morjim</label><br>
        <input type="checkbox" id="candolim" name="candolim">
        <label for="candolim"> Candolim</label><br>
        <input type="checkbox" id="anjuna" name="anjuna">
        <label for="anjuna"> Anjuna</label><br>

I have database table having location column name location.

Now i want if somebody checks a or more checkboxes need to get data from database using combination of those checkboxes.i dont want to put any submit button instead it should instantly send ajax request as checkbox checks. How can i build a jquery script and sql queries ? i am a beginner . please help.. Thanks .




Aucun commentaire:

Enregistrer un commentaire