帖子
帖子
用户
博客
课程
显示全部楼层
3
帖子
0
勋章
99
Y币

[云开发] 怎样用jquery跨域ajaxAPICLOUD中的数据库呢?求大神!

[复制链接]
发表于 2015-5-9 12:22:50
如题!跪求大神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)}               
                }


89
帖子
0
勋章
1万+
Y币
hq.setRequestHeader("X-APICloud-AppKey",appKey);
这里不完整吧,需要contentType吧?请求时jsonp格式
89
帖子
0
勋章
1万+
Y币
hq.setRequestHeader("X-APICloud-AppKey",appKey);
这里不完整吧,需要contentType吧?请求时jsonp格式
3
帖子
0
勋章
99
Y币
huguoba 发表于 2015-5-9 12:27
hq.setRequestHeader("X-APICloud-AppKey",appKey);
这里不完整吧,需要contentType吧?请求时jsonp格式 ...

请问具体怎么修改呢?
您需要登录后才可以回帖 登录

本版积分规则