You do not call actions like that in Cakephp.
First set up an Action in one of your Controllers call the url from your $.ajax function like this.
function updateResult(tab){
$.ajax({
url:"/controller/request_specimen",
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>';
}
});
}
You could later on add a route for request_specimen and make it prettier.
In your Controller there should be a method called: public function request_specimen() {}
Wich will handle the ajax request like so: if($this->request->is(['ajax']) { /* Handle request */}
The data sent to the function will be in $this->request->data;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…