2009-12-22 07:59:16 +00:00

28 lines
770 B
JavaScript

$(document).ready(function(){
var siren = '';
var options = {
target: '#frmSurv',
url: './pages/ajax_surveillance.php',
beforeSubmit: showRequest,
success: showResponse
};
$('#frmSurv').submit(function() {
$(this).ajaxSubmit(options);
return false;
});
function showResponse(responseText, statusText) {
$("#frmSurv").replaceWith('' + responseText + '');
if(statusText == 'success' && siren != ''){
document.location.href = './?page=surveillance';
}
}
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;
}
});