Hi all,
When I was doing some self-learning on JQuery Ajax in Cakephp,
I found out some strange behaviour in the JQuery Alert Box.
Here are a few lines of code of the JQuery Ajax I used:
$(document).ready(function(){
$(document).change(function(){
var usr = $("#data\\[User\\]\\[name\\]").val();
$.post{"http://www.mywebsite.com/controllers/action/",
usr,
function(msg){alert(msg);}
}
});
});
The Alert box shows me a message returned from the Action:
Helloworld
<!--0.656s-->
I am not sure why the number of time consumption was displayed in the Alert box,
since it was not in my code as follows:
function action($data=null){
$this->autoRender = false;
$result2=$this->__avail($data);
if($result2==1)
{return "OK";}
else
{return "NOT";}
}
CakePHP rteurned some extra information in the Alert box.
Later I altered a single line of code and tried out this instead,
and the time consumption was not displayed on screen then:
$(document).ready(function(){
$(document).change(function(){
var usr = $("#data\\[User\\]\\[name\\]").val();
$.post{"http://www.mywebsite.com/controllers/action/",
usr,
function(msg){$("#username").append('<span>'+msg+</span'>);}
}
});
});