我有一个HTML5游戏,在桌面上运行得很好,对于排行榜(以及更多的东西),我使用ajax发送参数和接收数据。
事实是,一切都很好,但在cocoon中,cocoonjs根本不能工作,我不知道为什么,jQuery得到了支持,理论上一切都应该很好。有人知道为什么这段代码不能工作吗?
提前谢谢。
$.ajax({
type: 'GET',
url: this.baseURL+'/getScores.php',
data: {
'theGame': '1',
'theOrder': 'ASC'
},
fail: function(msg){
alert(msg);
}
});我也在尝试这个代码(在cocoonjs中不起作用)
$.getJSON( STK.root.urlBase+"/getScores.php",
{ theGame: "1", theOrder: "ASC" }
)
.done(function(data) {
//DO STUFF
})
.fail(function( jqxhr, textStatus, error ) {
console.log( "Request failed: " + err );
});发布于 2015-05-29 17:42:23
好吧,一切都是CORS的事情,我在接收/发送数据的php文件中用这个头文件修复了它:
header("Access-Control-Allow-Origin: *");https://stackoverflow.com/questions/30442747
复制相似问题