Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#10941 closed bug (invalid)

When the same request multiple jsonp, browser through a window[jsonpCallback] not defined.

Reported by: cfddream Owned by: cfddream
Priority: low Milestone: None
Component: ajax Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Description

First, I do not define the window[jsonpCallback] function, jQuery will define it. But when the same request multiple jsonp, the browser through a error window[jsonpCallback] not defined. I test it from v1.5.2 to v1.7.1.

!#javascript
$.ajax({
    type: 'get',
    dataType: 'jsonp',
    data: 'query=' + encodeURIComponent(v),
    jsonp: 'callback',
    jsonpCallback: 'docallback',
    cache: true,
    url: 'http://abcd.com/e.php',
    success: function (data) {
        //do something        
    }
});

So I had to this way fix it.

window[jsonpCallback] = function () {};

Change History (6)

comment:1 Changed 8 years ago by cfddream

window[jsonpCallback] = function () {};

comment:2 Changed 8 years ago by sindresorhus

Owner: set to cfddream
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

comment:3 Changed 8 years ago by cfddream

Status: pendingnew

comment:4 in reply to:  2 Changed 8 years ago by cfddream

Replying to sindresorhus:

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

This is my test case http://jsfiddle.net/cfddream/ZHPLB/

comment:5 Changed 8 years ago by sindresorhus

Component: unfiledajax
Priority: undecidedlow
Resolution: invalid
Status: newclosed

You'd set your testcase to use jQuery 1.5.2. When I set it to jQuery 1.7.1, I didn't get any error.

comment:6 in reply to:  5 Changed 8 years ago by cfddream

Replying to sindresorhus:

You'd set your testcase to use jQuery 1.5.2. When I set it to jQuery 1.7.1, I didn't get any error.

Thanks. But, " i != data.i" . I think the correct result should be "i === data.i".

Note: See TracTickets for help on using tickets.