I'm using ajax to validate a from without reloadind the page.
Script Ajax
function updateResult(tab){
$.ajax({
url:"requeteSpecimen.php",
data:{datas:tab},
dataType: 'text',
async:false,
success: function(data){
document.getElementById('resultat').innerHTML = '<p>'+data+'</p>';
},
error: function(data){
document.getElementById('resultat').innerHTML = '<p>ERROR</p>';
}
});
}
$("#filtre").submit(function(){
<?php $tab=$this->request->data; ?>
updateResult(<?php json_encode($tab);?>);
});
</script>
requeteSpecimen.php
<?php echo "Success"; ?>
My problem is that ajax do not call the sucess function, I always have the "ERROR" text appearing ...
For the moment I don't have yet the code of my requeteSpecimen.php file and I just would like the success function to be called. Don't know if it can help but I'm using cakePHP 3.0.
Many thanks in advance.
See Question&Answers more detail:os