reqwest icon indicating copy to clipboard operation
reqwest copied to clipboard

Pass status and XHR to success and complete handlers

Open inf0rmer opened this issue 12 years ago • 6 comments

Hi,

I needed to access the XHR object on my success handlers, so I added this quick hack. Is this the proper way to do it? Also, is there any reason it wasn't included from the start?

Thanks!

inf0rmer avatar Jul 23 '12 11:07 inf0rmer

+1 for this.

posativ avatar Oct 25 '12 20:10 posativ

@inf0rmer whydid you remove the IE JSONP hack? And.. you've edited the build file, reqwest.js and also the source file src/reqwest.js, you should only be editing the latter for your commits. Cheers.

rvagg avatar Oct 25 '12 23:10 rvagg

Ah, about the IE thing, I must've screwed up the pull request. I only meant to commit the part relevant to the request title. It's unrelated to this issue, but I had to do that or otherwise JSONP requests would not work on IE10 (although that was on a beta version, but I needed it for a project at the time).

A similar excuse about pullrequesting the built file, that was a silly mistake. My first pull request, how much more wrong could it have gone? :P

inf0rmer avatar Oct 29 '12 15:10 inf0rmer

Congrats on your first pull request! It's great that you decided to contribute to Reqwest.

Interesting news that JSONP is broken on IE10, I really need to sort out a Windows 8 machine now that IE10 is in the wild.

To fix the pull request, you can either make another commit to your master branch and it'll fix it up here (it's better to do a PR from a separate branch by the way so it's easier to avoid adding extraneous commits), or close this PR and open a new one with just the commit/changes you're proposing.

rvagg avatar Oct 29 '12 21:10 rvagg

If you set the type to something non-existing, you get the original XHR object, see this example.

adrianheine avatar Feb 07 '13 09:02 adrianheine

I also have a use case for the XHR object.

@ded Can we get something similar merged, JSONP hack for IE notwithstanding?

terinjokes avatar Sep 13 '13 20:09 terinjokes