Skip to content

jsonp is called instead of json in cross domain requests#329

Closed
ubershmekel wants to merge 1 commit into
jquery:masterfrom
ubershmekel:patch-1
Closed

jsonp is called instead of json in cross domain requests#329
ubershmekel wants to merge 1 commit into
jquery:masterfrom
ubershmekel:patch-1

Conversation

@ubershmekel
Copy link
Copy Markdown
Contributor

This was surprising to me and I'm still not sure how to handle cross-domain jsonp 404 responses.

@JonathanThiyagarajan
Copy link
Copy Markdown

If you are trying to post a data. you could not do it So, You Can use get method in regards with the cross domain, Trying using crossdomain:true, in your ajax call

@ubershmekel
Copy link
Copy Markdown
Contributor Author

The jsonp request in question happens on my site for example here http://www.redditp.com/r/qwer/awwasdfasdfasdfa/ note that I do give an error after a timeout though the 404 arrives before the alert pops up. Will crossdomain:true help me catch and handle the 404 event?

@JonathanThiyagarajan
Copy link
Copy Markdown

U can Very handle the 404 Event.

@gnarf
Copy link
Copy Markdown
Member

gnarf commented Nov 21, 2013

So long as you are in here, could you separate each of those <li> onto it's own line? It would make this much easier to review. I can tell you from a quick read that you'll want to remove the ...

Also, have you signed the CLA? http://contribute.jquery.org/CLA/

@ubershmekel
Copy link
Copy Markdown
Contributor Author

Fixed that and just signed. I'll verify the 404's catchable with crossdomain:true hopefully in ~10 hours.

@kswedberg
Copy link
Copy Markdown
Member

I think this is too vague/incomplete, and I'm not quite sure how to fix it. In which cases does it force a "jsonp request"? Did you verify the catchable 404s? You can make an xhr post or get using CORS and it won't try to use jsonp. You would need to set the xhrFields option:

xhrFields: {
    withCredentials: true
}

Comment thread entries/jQuery.ajax.xml Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be on the previous line.

@gnarf
Copy link
Copy Markdown
Member

gnarf commented Dec 22, 2014

@ubershmekel - do you have any updates on this issue specifically for @kswedberg's comment? It seems like one of those awkward edge cases we don't want to document unless we can clearly explain the situation it occurs in.

@arthurvr
Copy link
Copy Markdown
Member

arthurvr commented Mar 7, 2015

@ubershmekel This PR needs some updates. See comments above. It would be nice if you could do them?

@ubershmekel
Copy link
Copy Markdown
Contributor Author

Fixed the complaints and fixed the merge. From my testing crossdomain does not help detect the 404. The 404 being undetectable may be a browser security feature.

@arthurvr
Copy link
Copy Markdown
Member

arthurvr commented Apr 9, 2015

Thanks @ubershmekel. What do we think @gnarf @kswedberg?

@dmethvin
Copy link
Copy Markdown
Member

dmethvin commented Apr 9, 2015

I definitely like this formatting better. For this:

Cross-domain requests may invoke "jsonp" unless explicitly "jsonp" is set to false.

I'd change it to something like:

Cross-domain "json" requests are converted to "jsonp" unless the request includes jsonp: false in its request options.

@arthurvr
Copy link
Copy Markdown
Member

ping @ubershmekel

@ubershmekel
Copy link
Copy Markdown
Contributor Author

Sorry guys, I was abroad for a few weeks. It's a bit of a pain that every time I come back to this tiny change the pull request has merge conflicts.

I do like the proposed wording. If I fix it per @dmethvin would that be the final iteration?

@arthurvr
Copy link
Copy Markdown
Member

It's a bit of a pain that every time I come back to this tiny change the pull request has merge conflicts.

For now feel free to not care about merge conflicts. I can take care of them while merging.

Relevant li's have newlines between them now.
@ubershmekel
Copy link
Copy Markdown
Contributor Author

Rebased with the new wording.

@ubershmekel
Copy link
Copy Markdown
Contributor Author

Ping @dmethvin @arthurvr before the next conflict.

@dmethvin
Copy link
Copy Markdown
Member

Whoa, sorry this got buried. LGTM!

Comment thread entries/jQuery.ajax.xml
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"xml"

I wonder if these shouldn't be in <code> elements. For the rest this LGTM!

@arthurvr
Copy link
Copy Markdown
Member

I'm going to make that trivial change myself and land this one. Thanks for your hard work, @ubershmekel, and sorry for it taking too long :)

@arthurvr arthurvr closed this in be83880 May 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

8 participants