开发者

Is that possible to call to external PHP script from Ajax?

I'm trying to call to external PHP script using Ajax like this:

$(function() {
    $.ajax({'url': 'http://stokes.chop.edu/web/zscore/result.php',
            'type': 'POST',
            'success': function(response, textStatus, XMLHttpRequest) {
                alert('[' + response + ']');
            },
            'error': function(XMLHttpRequest, textStatus, errorThrown) {
                alert('Error');
            }
    });
});

The result is: [] (i.e. success function is called!), but I see the following error in HTTPFOX plugin for FireFox:

Error loading content (N开发者_Go百科S_ERROR_DOCUMENT_NOT_CACHED)

What's wrong with my code ?


You cannot load contents from pages that does not have the same domain name as the one from which the ajax request is called from. This is a well known security feature call the Same Origin Policy.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜