开发者

AJAX functionality not working

My questions are:

  1. How can I know if the AJAX is working properly?.
  2. How can I retrieve the sent data in the controller in CakePHP?

My code is:

function checkLength(obj,url){
    alert("URL="+url+"   OBJ="+obj); 

    if(obj)
    {
        var params = 'query='+obj; 
        var myAjax = new Ajax.Request(url,{method: 'post',paramete开发者_运维问答rs:params,onSuccess: loadResponse}); 
    }
}


I tend to use Firebug to debug my ajax, as the Net tab works fantastically for seeing outgoing requests along with what is returned from your script.

Check it out, http://getfirebug.com/


@Rajesh If you want to receive the data send from this function to the back end you can view the content using the $_POST[] array object in u r cakephp or the data[field] attribute of the controller

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜