JSON asynchronous requests not caught

123 views
Skip to first unread message

NadAF

unread,
May 30, 2011, 2:07:18 PM5/30/11
to Firebug
Hi,
Why cannot FireBug catch JSONP asynchronous requests?

Thanks!

Jan Honza Odvarko

unread,
May 30, 2011, 2:10:21 PM5/30/11
to Firebug
On May 30, 8:07 pm, NadAF <nadeem...@gmail.com> wrote:
> Hi,
> Why cannot FireBug catch JSONP asynchronous requests?
Of course, it can catch them.
Honza

NadAF

unread,
May 30, 2011, 8:49:29 PM5/30/11
to Firebug
They're no being caught on my browser. What can be wrong??

Jan Honza Odvarko

unread,
May 31, 2011, 2:08:58 AM5/31/11
to Firebug
We have a test page related to JSONP here:
http://getfirebug.com/tests/content/branches/1.8/net/2209/issue2209.html
Please try whether it works for you (follow instructions on the page)

If this test works for you, but you have problems in another case,
we need:

1) Firebug + Firefox version info
2) New test case + instructions how to reproduce the problem on our
machines

Honza

NadAF

unread,
May 31, 2011, 3:10:52 PM5/31/11
to Firebug
The example you gave me shows in FireBug. But when jQuery is used, it
never shows up though the request was successful.

Test case example: (http://customyt.com/#dVVZaZ8yO6o) Type anything in
search input and JSONP request is made to the server)
Firebug: 1.7.1
FireFox: 4.0.1

Thanks!!

Bill Barry

unread,
May 31, 2011, 6:02:06 PM5/31/11
to fir...@googlegroups.com
Can you use non-minimized javascript there so it is easier to debug?

NadAF

unread,
May 31, 2011, 8:36:41 PM5/31/11
to Firebug
Here is another simpler example: http://jsfiddle.net/hxbd2/

Jan Honza Odvarko

unread,
Jun 1, 2011, 2:54:46 AM6/1/11
to Firebug
I have been tested with the following page and if I press the button,
I am seeing one request in the Net panel (when I expand the request I
see JSONP).

Honza

<html>
<head>
<title>Test Case for Issue #4391</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/
libs/jquery/1.6.1/jquery.js"></script>
</head>
<body>

<button onclick="onExecuteTest()">Execute Test</button>

<script type="text/javascript">
function onExecuteTest()
{
$.get("http://gdata.youtube.com/feeds/api/videos?
format=5&v=2&alt=jsonc", null,
function(response) {
if (response.data.items) {
console.log('JSONP request completed successfully');
}

}, 'jsonp')

.error(function() {
alert('An error ocurred.')
})
}
</script>

</body>
</html>


NadAF

unread,
Jun 1, 2011, 1:24:52 PM6/1/11
to Firebug
Yes, it appears in the Net Panel. But why does it not appear in the
console panel as all other requests???

Jan Honza Odvarko

unread,
Jun 1, 2011, 2:58:57 PM6/1/11
to Firebug
On Jun 1, 7:24 pm, NadAF <nadeem...@gmail.com> wrote:
> Yes, it appears in the Net Panel. But why does it not appear in the
> console panel as all other requests???
Ah, I see the problem now!

A new issue report created here:
http://code.google.com/p/fbug/issues/detail?id=4482

Thanks!
Honza

NadAF

unread,
Jun 1, 2011, 4:35:02 PM6/1/11
to Firebug
OK. Thank you. I hope they will fix it!

Jan Honza Odvarko

unread,
Jun 2, 2011, 5:22:39 AM6/2/11
to Firebug
So, it turned out that it's not a bug.

The Console doesn't display the request since it isn't XHR. jQuery
uses <script> tag for cross domain JSNOP requests. See
jQuery.ajaxTransport in jQuery source.

Honza

NadAF

unread,
Jun 2, 2011, 1:48:09 PM6/2/11
to Firebug
Ok. Can you provide me a link or something to see that? because here
(http://api.jquery.com/extending-ajax/) it is not mentioned.

Bill Barry

unread,
Jun 2, 2011, 3:33:29 PM6/2/11
to fir...@googlegroups.com
In the documentation it says that jsonp is not an ajax requst (no XHR)

http://api.jquery.com/jQuery.get/

The actual running code is:
https://github.com/jquery/jquery/blob/master/src/ajax/script.js

(it adds a script tag to the end of the head of the page, or to the
document if the head cannot be found)

JSONP is a special case of script (you can do a script request as well
with jquery, but I don't know what the documentation says about it
anymore; script is a simple matter of adding a new script tag to the page).

Reply all
Reply to author
Forward
0 new messages