thanks for reading my problem and sorry if my english is not perfect.
So, my problem is when i send a form via ajax with the method post, my page bug when reloading. After some test, i found that if i use the method get, everything works fine. I don't get it. Also, if i comment the select part, it works even with post.
Here is my code: The ajax function:
function showDispo(){
validate($('#frmUpdateTaux'));
}
function validate(form) {
$.ajax({
url: "updateDispo.php"
, data: $(form).serialize()
, datatype: 'json'
, type: 'post'
, error: function(error, errmsg){
alert(errmsg + ' :=: ' + error.responseText );
}
, success: function(Data) {
location.reload(true);
}
});
}
and my html code:
<form method="get" id="frmUpdateTaux">
<table border="0" cellspacing="0" cellpadding="2">
<tr>
<td align="left">
<label class="lbl" id="lblMois" name="lblMois" for="lstMois">Mois :</label>
</td>
<td align="left">
<select id="lstMois" name="lstMois" size="1">
<option value="1">Janvier</option>
<option value="2">Février</option>
<option value="3">Mars</option>
</select>
</td>
</tr>
<tr>
<td align="left" colspan="2">
<input type="button" id="btnGenerate" name="btnGenerate" value="Mettre à jour" onclick="showDispo()">
</td>
</tr>
</form>
UpdateDispo.php
require_once("BD.php"); $month= $_POST["lstMois"]; /*query */ $insertNewIndispo ='...' //execution of the query
//QUERY INSERT $insertNewIndispo ='...'
$exec = BD::run($insertNewIndispo, BD::QUERY_INSERT, false, false);
FYI: I want to reload the page to display the results of a query run in this page and new values are inserted in the DB table by UpdateDispo.php
Do you have an idea where the problem comes from?
Thanks.