错误:jQuery的不叫 [英] Error : : jQuery was not called

查看:147
本文介绍了错误:jQuery的不叫的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的AJAX调用。

  $。阿贾克斯({
    键入:GET,
    网址:http://example.com/v1/search?keyword=r
    数据类型:JSONP
    跨域:真正的,
    成功:函数(responseString){
        警报(responseString);
    },
    错误:函数(XHR,ERRORTYPE,例外){
        VAR的errorMessage =异常|| xhr.statusText;
        警报(的errorMessage);
    }
});
 

这是我的例子URL响应

  {
    响应: [{
        属性:{
            类型:恩格,
            URL:/services/data/v24.0/sobjects/Challenge__c/a0GZ0000005Vvh4MAC
        },
        名:真的,
        END_DATE:2013-02-07T15:26:00.000 + 0000,
        总:350.0,
        registered_members:0.0,
        ID:30,
        类型:设计,
        ID:a0GZ0000005Vvh4MAC
        START_DATE:2012-11-19T16:52:00.000 + 0000,
        说明:这是我真的很酷的挑战,
        remaining_days:28.0,
        categories__r:[{
            属性:{
                类型:Category__c,
                URL:/服务/数据/ Category__c / a08Z0000000RNI2IAO
            },
            ID:0RN​​I2IAO
            DISPLAY_NAME:安迪
        },{
            属性:{
                类型:Category__c,
                URL:/服务/ Category__c / a08Z0000000RNI3IAO
            },
            ID:a0O
            DISPLAY_NAME:ADR
        }]
    }

    }],
    伯爵:1
}
 

我试图使一个跨域调用,并得到错误

  jQuery180014405992737595236_1357861668479不叫
 

更新

嗯,我试图用数据类型:JSON,但在这一点上得到错误

 无交通运输
 

解决方案

这表明,无论是网络错误或终点不返回一个JSONP响应。

(我猜的DNS查找失败我测试的时候是因为这是不是你真正的URL(请使用 example.com 例如网址,即获得就是它是有)如果不是,那么这就是你的问题)。

Here is my ajax call.

 $.ajax({
    type: "GET",
    url: "http://example.com/v1/search?keyword=r",
    dataType: "jsonp",
    crossDomain: true,
    success: function (responseString) {
        alert(responseString);
    },
    error: function (xhr, errorType, exception) {
        var errorMessage = exception || xhr.statusText;
        alert(errorMessage);
    }
});

Response from my example url

    {
    "response": [{
        "attributes": {
            "type": "enge",
            "url": "/services/data/v24.0/sobjects/Challenge__c/a0GZ0000005Vvh4MAC"
        },
        "name": "Really",
        "end_date": "2013-02-07T15:26:00.000+0000",
        "total": 350.0,
        "registered_members": 0.0,
        "id": "30",
        "type": "Design",
        "id": "a0GZ0000005Vvh4MAC",
        "start_date": "2012-11-19T16:52:00.000+0000",
        "description": "This is my really cool challenge",
        "remaining_days": 28.0,
        "categories__r": [{
            "attributes": {
                "type": "Category__c",
                "url": "/services/data/Category__c/a08Z0000000RNI2IAO"
            },
            "id": "0RNI2IAO",
            "display_name": "Andy"
        }, {
            "attributes": {
                "type": "Category__c",
                "url": "/services/Category__c/a08Z0000000RNI3IAO"
            },
            "id": "a0O",
            "display_name": "ADR"
        }]
    }

    }],
    "count": 1
}

i'm trying to make an cross domain call and getting error

jQuery180014405992737595236_1357861668479 was not called

Update

Well i tried to use dataType:"json" but at that point getting error

No Transport

解决方案

That suggests either a network error or an end point that doesn't return a JSONP response.

(I'm guessing the DNS lookup failure I get when testing it is because that isn't your real URL (please use example.com for example URLs, that is what it is there for) if not, then that is your problem).

这篇关于错误:jQuery的不叫的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆