dounao2829 2014-02-06 18:38
浏览 167
已采纳

CURL工作,JSON无法正常工作

I have a Json get request that works perfectly when I use CURL to send it over php , but when I try to do the same thing with getJSON (which is the requirement), all I get back is status is error when I use the code below. How can I know exactly what the error is ? I dont know if I am sending the request with wrong parameters of if its a time out, or what it could be. Thanks

         $.getJSON(url, function(data,status,xhr) {
          if (status == "success"){
     alert ("got the data"+data);
}else if (status == "timeout"){
    alert("Something is wrong with the connection");
}else if (status == "error" || status == "parsererror" ){
    alert("An error occured");
}else{
    alert("datatosend did not change");
}       
         })
  • 写回答

2条回答 默认 最新

  • dopa53272 2014-02-07 15:25
    关注

    the answer was that although I was on the same domain I was not putting https on the url to get which is what my site was using.

    thanks

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办