Vote count:
0
I have a form which has some hidden fields and the values are set on load of the page. I have an Ajax script which submits the form on click of a button. When I click the button it submits the form and after some database checks an email goes to the client. And I receive a message telling that the submit is successful and the values of the hidden fields are shown as below before the first submit:
<input type="hidden" name="propertyID" id="propertyID" value="1" />
<input type="hidden" name="uyeID" id="uyeID" value="10" />
<input type="hidden" name="referrerfile" id="referrerfile" value="Property For Sale" />
Just after the submit the values on the browser debugger is as below:
<input type="hidden" name="propertyID" id="propertyID" value="">
<input type="hidden" name="uyeID" id="uyeID" value="">
<input type="hidden" name="referrerfile" id="referrerfile" value="">
I don't understand what the possible reason is but it can't make database checks and send emails as these fields have no value.
Here is my Ajax script on click of the button:
if(proceed)
{
//data to be sent to server
post_data = {'userName':user_name, 'userEmail':user_email, 'userPhone':user_phone, 'userMessage':user_message, 'imageverification':imageverification, 'propertyID':propertyID, 'uyeID':uyeID, 'referrerfile':referrerfile, 'departuredate':departuredate, 'arrivaldate':arrivaldate };
//Ajax post data to server
$.post('owner_contact.php', post_data, function(response){
//load json data from server and output message
if(response.type == 'error')
{
output = '<div class="error">'+response.text+'</div>';
refresh_image();
}
else
{
output = '<div class="success">'+response.text+'</div>';
//reset values in all input fields
$('#contact_form input').val('');
$('#contact_form textarea').val('');
}
$("#result5").hide().html(output).slideDown();
}, 'json');
} else {
//$("#result").slideDown();
refresh_image();
}
});
Any idea what the problem can be?
asked 1 min ago
Jquery/Ajax form loses the hidden field values on second click
Aucun commentaire:
Enregistrer un commentaire