2009-05-25 13:19:02 +00:00

29 lines
822 B
JavaScript

$(document).ready(function(){
var siren = '';
$('#frmSurv').submit(function() {
var options = {
target: '#frmSurv',
url: './pages/ajax_surveillance.php',
beforeSubmit: showRequest,
success: showResponse,
timeout: 3000,
};
$(this).ajaxSubmit(options);
return false;
});
function showResponse(responseText, statusText) {
$("#frmSurv").replaceWith('' + responseText + '');
if(statusText == 'success' && siren != ''){
document.location.href = './?page=surveillance'; /*Recharger la page*/
}
}
function showRequest(formData, jqForm, options) {
var value = $('input[type=hidden][name=formSurv[siret]]').fieldValue();
siren = value[0];
$("#frmSurv").replaceWith('<div id="frmSurv">Mise sous surveillance en cours...</div>');
return true;
}
});