【问题标题】:Get JSON response using jQuery.ajax request to an appengine URL?使用 jQuery.ajax 请求获取对 appengine URL 的 JSON 响应?
【发布时间】:2015-06-24 04:23:46
【问题描述】:

我尝试使用 ajax 从下面的 url 获取响应数据

http://recipesid.appspot.com/api.user?method=user.query&email=dam.le@anttek.com

但它无论如何都不会运行。

帮我解决问题

$.ajax({
        type: "GET", //rest Type
        dataType: 'jsonp', //mispelled
        url: "http://recipesid.appspot.com/api.user?method=user.query&email=dam.le@anttek.com",
        async: false,
        contentType: "application/json; charset=UTF-8",
        success: function (msg) {
            alert(msg);                
        },
        error:
    function(data){ 
        alert("error");
    } });

提前致谢!!

【问题讨论】:

  • “无论如何都无法运行”是什么意思?需要说出你的期望,发生了什么,你有什么错误/调试信息!!
  • 这意味着它总是返回错误。
  • 您想告诉我们错误是什么吗?
  • 当我使用hurl.it 来测试我的网址时。替代协议:80:quic,p=0 内容长度:213 内容类型:应用程序/json; charset=UTF-8 日期:2015 年 6 月 24 日星期三 04:29:21 GMT 服务器:Google 前端并返回真实结果
  • 我正在使用 java 在谷歌应用引擎中创建这个应用程序。

标签: javascript jquery ajax json google-app-engine


【解决方案1】:

感谢所有回答。但我有一个解决方案。

我必须在我的谷歌应用引擎中允许“Access-Control-Allow-Origin”。

【讨论】:

  • 那个错误 is 显然出现在浏览器控制台日志中。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-06-20
  • 1970-01-01
  • 1970-01-01
  • 2021-10-20
  • 1970-01-01
相关资源
最近更新 更多