开发者

jQuery AJAX help

开发者 https://www.devze.com 2023-01-22 02:36 出处:网络
I am new here, and I have looked at the other 开发者_JAVA百科Ajax Help topics, however, I still can\'t see why mine isn\'t working.

I am new here, and I have looked at the other 开发者_JAVA百科Ajax Help topics, however, I still can't see why mine isn't working.

Here it is:

$(document).ready(function(){
    $.ajax({
        type: "GET",
        url: "localhost/val.php",
        data: "val=RichieC",
        success: function(msg){
            alert("WOO");
        }
    });
});

Has anyone got any ideas? I've tried a few things!

Thanks!


Try putting http://localhost/val.php in the url. The way it is now will look for a localhost folder in the current directory.


Did you debug val.php and verify that your server side code is running when you make the AJAX call? If your action is executing, you can make sure everything is working as expected by just stepping through (or alternatively, as Quintin Robinson suggested, you could add a failure callback to see if that is being called).

If your action is doing what you think it should do and still no callbacks are firing, well, that one's a toughie :)

0

精彩评论

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