Syntax of ajax in php with mysql database with example


Basic syntax of ajax used in php with mysql database with example Step by Step   How to access and used JQuery AJAX and php to fetch and display data from a mysql database .Working with ajax php and mysql without refreshing fetch data from mysql database.


 $(document).ready(function(){  // document ready Start


// Select dropdown ID name Action on click

   var batchselect = $("#batchselect").val(); 





                      // data:"action=showcomment", //

                     // data:"phonenocomment="+phonenoset+"",



  // ID Name set Same in PHP Div







PHP Onclick search Ajax Data

<select class="form-control" id="batchselect" name="batchcodeselect" style="width:628px;" >

 <option value=""> Select Course </option>


$showst=mysql_query("Select * from coursetimetable");


<option value="<?php echo $rowlinkst['id']; ?>,<?php echo $rowlinkst['coursename']; ?>"><?php echo $rowlinkst['coursename']; ?></option>

<?php } ?>



PHP syntax :

 <div class="col-lg-12" id="dismsgcomment" style="color:#000000;  padding: 14px 0px;"></div>