Cake returned the time consumed in data lookup in JQuery Alert Box
Posted
by kwokwai
on Stack Overflow
See other posts from Stack Overflow
or by kwokwai
Published on 2010-05-30T19:41:54Z
Indexed on
2010/05/30
19:52 UTC
Read the original article
Hit count: 162
cakephp
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'>);}
}
});
});
© Stack Overflow or respective owner