2009-05-20 15:49:08 +00:00
|
|
|
$(document).ready(function(){
|
2009-05-25 13:19:02 +00:00
|
|
|
var siren = '';
|
2009-06-03 14:07:14 +00:00
|
|
|
var options = { target: '#frmSurv', url: './pages/ajax_surveillance.php', beforeSubmit: showRequest, success: showResponse, timeout: 3000 };
|
2009-05-25 13:19:02 +00:00
|
|
|
|
2009-05-20 15:49:08 +00:00
|
|
|
$('#frmSurv').submit(function() {
|
|
|
|
$(this).ajaxSubmit(options);
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
function showResponse(responseText, statusText) {
|
|
|
|
$("#frmSurv").replaceWith('' + responseText + '');
|
2009-05-25 13:19:02 +00:00
|
|
|
if(statusText == 'success' && siren != ''){
|
|
|
|
document.location.href = './?page=surveillance'; /*Recharger la page*/
|
2009-05-22 12:26:07 +00:00
|
|
|
}
|
2009-05-20 15:49:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function showRequest(formData, jqForm, options) {
|
2009-05-25 13:19:02 +00:00
|
|
|
var value = $('input[type=hidden][name=formSurv[siret]]').fieldValue();
|
|
|
|
siren = value[0];
|
2009-05-20 15:49:08 +00:00
|
|
|
$("#frmSurv").replaceWith('<div id="frmSurv">Mise sous surveillance en cours...</div>');
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|