Jquery getJSON Not Working Cross Site

Posted by CJ on Stack Overflow See other posts from Stack Overflow or by CJ
Published on 2010-06-14T16:17:09Z Indexed on 2010/06/14 16:22 UTC
Read the original article Hit count: 400

Filed under:
|
|
|
|

I have a piece of javascript that grabs JSON data. When executed locally everything seems to work fine. However, when I try accessing it from a different site, it doesn't work.

Here's the script.

$(function(){
    var aT = new AjaxTest();
    aT.getJson();
});

var AjaxTest = function()
{
    this.ajaxUrl = "http://mydeveloperpage.com/sandbox/ajax_json_test/client_reciever.php";

    this.getJson = function(){
        $.getJSON(this.ajaxUrl, function(data){
            $.each(data, function(i, piece){
                alert(piece);
            });
        });
    }
}

You can find a copy of the exact same file at "http://mydeveloperpage.com/sandbox/ajax_json_test/".

Any help would be greatly appreciated.

Thanks!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX