extranet/includes/surveillance/script.js
2009-06-03 14:07:14 +00:00

23 lines
791 B
JavaScript

$(document).ready(function(){
var siren = '';
var options = { target: '#frmSurv', url: './pages/ajax_surveillance.php', beforeSubmit: showRequest, success: showResponse, timeout: 3000 };
$('#frmSurv').submit(function() {
$(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;
}
});