我在运行我的 django 应用程序的同一主机上运行了一个休息服务器(python 瓶)。从我的 django 应用程序中,我正在使用 ajax 执行获取请求,但是即使我可以在我的休息服务器上看到请求的状态成功,请求也会失败(返回代码 200,成功)
我的阿贾克斯代码:
$.ajax({
url: 'http://hostname:port/ListVms/',
crossDomain: true,
contentType: "application/json",
dataType: 'jsonp',
success: function(data) {
alert('worked');
},
error: function() {
alert("Sorry, error retrieving!");
}
});
Python 休息方法:
@route('/ListVms/', method='GET')
def get_event():
return json.dumps(JS)
其余服务的输出:
[22/Aug/2012 10:25:45] "GET /ListVms/?callback=jQuery17102901058990901989_1345656355311&_=1345656355356 HTTP/1.1" 200 44