23 lines
791 B
JavaScript
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;
|
|
}
|
|
}); |