Insert Into Mysql Database Without Refreshing Page Using Ajax Not Working
i try to insert some data into a mysql db table without refreshing page so i write this script to send the data to a php page that contain the query that will be executed by click
Solution 1:
Add a id to the form and prevent the form submit.
<tr>
<form id="reservation_form">
<td><input required type="text"id="client" name="title"></td>
<td><input required type="text"id="tel" name="tel"></td>
<td><input required type="date"id="start" placeholder="yy-MM-dd"
name="start"></td>
<td><input required type="date"id="end" placeholder="yy-MM-dd"
name="end"></td>
<td><input required type="number"id="prix" name="prix"></td>
<td></td>
<td><input type ="submit"id="submit_reservation" class="btn btn-info"
name="submit" value="ajouter" style="width: 70px"></td>
<td></td>
</form>
</tr>
$("#reservation_form").submit(function(event){
event.preventDefault();
... Your logic ...
}
Post a Comment for "Insert Into Mysql Database Without Refreshing Page Using Ajax Not Working"