I have a form that runs a php script in the background on button push The problem is that when I use the form on a iPad the response is cached This is solvable by making the post data unique and I want to do this by adding a hidden field which contains the current epoch time.
Currently I use :
$(document).ready(function(){
$("#myform").validate({
debug: true,
submitHandler: function(form) {
// do other stuff for a valid form
$.post('process.php', $("#myform").serialize(), function(data) {
$("#myform").append(data.datum);
var datum = Date.getTime();
$('input[name=datum]').val(datum);
$('#results').html(data);
});
}
});
});
this does not seem to work :(
You need to place the two lines that deal with the date before you post the data e.g:
$(document).ready(function(){
$("#myform").validate({
debug: true,
submitHandler: function(form) {
// do other stuff for a valid form
var datum = Date.getTime();
$('input[name=datum]').val(datum);
$.post('process.php', $("#myform").serialize(), function(data) {
$("#myform").append(data.datum);
$('#results').html(data);
});
}
});
});
fixed it by putting no-cache headers in the POST location and dont need the epoch time anymore