简体   繁体   English

对Django服务器的跨域AJAX请求

[英]Cross-domain AJAX request to Django server

I'm trying to get data from Django server using jQuery. 我正在尝试使用jQuery从Django服务器获取数据。

Here is code I'm using: myCode 这是我正在使用的代码: myCode

    $(function(){
    function callback(res){
        console.log(res);
    }
    $.ajax({
            url: "http://www.chesno.org/ajax/dispatcher/",
            data: {
                "data": "{'cmd':'get_party_list'}"
            },
            dataType: 'json', 
            success: callback,
            complete: callback,
            crossDomain: true,
            async: false
        });
    })​

The interesting thing is that I'm able to reach data through browser or fiddler ( link ). 有趣的是,我能够通过浏览器或Fiddler( 链接 )访问数据。 Please give me a hint on what I'm doing wrong. 请给我提示我做错了什么。 The important part is that I don't have access to the server, I just can communicate with developers of the site and they don't know yet where the problem is. 重要的是,我无权访问服务器,只能与站点的开发人员进行交流,他们还不知道问题出在哪里。

服务提供商需要使用跨域资源共享 ,并使其资源使用与您的来源匹配的Access-Control-Allow-Origin标头进行响应。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM