|
[云开发]
怎样用jquery跨域ajaxAPICLOUD中的数据库呢?求大神!
[复制链接]
如题!跪求大神QAQ我写的代码,这一段就会出现跨域错误……急求答案啊!!
$.ajax({
method:"POST",
url:"https://d.apicloud.com/mcm/api/delegate_data",
beforeSend:function(hq){
hq.setRequestHeader("X-APICloud-AppId","A6968565094002");
var now = Date.now();
var appKey = hex_sha1("A6968565094002"+"UZ"+"***"+"UZ"+now)+"."+now
hq.setRequestHeader("X-APICloud-AppKey",appKey);
alert(appKey)
},data:{
'Name':data[0],
'Grade':data[3],
'qq':data[6],
'email':data[1],
'Join_time':today,
'phone':data[2],
'chcs':data[4],
'xc':data[5]
}
}).done(function (datsa, status, header) {
//success body
alert(status+"1")
if(datsa){alert(datsa)}
}).fail(function (header, status, errorThrown) {
//fail body
alert(header.readyState)
alert(header.status)
alert(header.responseText)
}).always(function(dats,a,b){alert(b)})
}catch(e){alert(e)}
}
|
|