Skip to main content

Bug Tracker

Side navigation

#10941 closed bug (invalid)

Opened December 02, 2011 08:32AM UTC

Closed December 05, 2011 11:12AM UTC

Last modified December 05, 2011 11:56AM UTC

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.

#!javascript
window[jsonpCallback] = function () {};
Attachments (0)
Change History (6)

Changed December 02, 2011 08:34AM UTC by cfddream comment:1

window[jsonpCallback] = function () {};

Changed December 02, 2011 09:10AM UTC by sindresorhus comment:2

owner: → 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.

Changed December 05, 2011 10:23AM UTC by cfddream comment:3

status: pendingnew

Changed December 05, 2011 10:35AM UTC by cfddream comment:4

Replying to [comment:2 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/

Changed December 05, 2011 11:12AM UTC by sindresorhus comment:5

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.

Changed December 05, 2011 11:56AM UTC by cfddream comment:6

Replying to [comment:5 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".