小编典典

错误::未调用jQuery

ajax

这是我的ajax电话。

 $.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": [{
        "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
}

我正在尝试进行跨域通话并收到错误消息

jQuery180014405992737595236_1357861668479 was not called

更新资料

好吧,我尝试使用dataType:“ json”,但是那时候出错了

No Transport

阅读 221

收藏
2020-07-26

共1个答案

小编典典

这表明网络错误或端点未返回JSONP响应。

(我猜测测试时遇到的DNS查找失败是因为这不是您的真实URL(请使用example.com示例URL,这就是它的用途),如果不是,那是您的问题)。

2020-07-26