extranet/includes/surveillance/script-ajax.js
2009-12-22 07:59:16 +00:00

31 lines
830 B
JavaScript

$(document).ready(function(){
$('input[type=checkbox][name=surveillance]').click(function() {
if($(this).attr('checked')== true){
$('#survForm').css('display','block');
}else{
$('#survForm').css('display','none');
}
});
var options = {
target: '#frmSurv',
url: './pages/ajax_surveillance.php',
beforeSubmit: showRequest,
success: showResponse
};
$('#frmSurv').submit(function() {
$(this).ajaxSubmit(options);
return false;
});
function showRequest(formData, jqForm, options) {
$('#frmSurv').replaceWith('<div id="frmSurv">Mise sous surveillance en cours...</div>');
return true;
}
function showResponse(responseText, statusText) {
$('#frmSurv').replaceWith('' + responseText + '');
if(statusText == 'success'){ return true; }else{ return false; }
}
});