Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing data to GM_xmlhttpRequest callbacks #1725

Closed
PetrToman opened this issue Mar 24, 2013 · 4 comments
Closed

Allow passing data to GM_xmlhttpRequest callbacks #1725

PetrToman opened this issue Mar 24, 2013 · 4 comments
Milestone

Comments

@PetrToman
Copy link

Sometimes it is useful to pass data to ajax callback functions. I suggest adding 'context' option like jQuery.ajax() has - see http://api.jquery.com/jQuery.ajax/

$.ajax({
   url: "test.html",
   context: document.body
}).done(function() {
   $(this).addClass("done");
});
@Y0ba
Copy link

Y0ba commented Apr 14, 2013

Use bind() function.

   url: "test.html"
}).done(function() {
   $(this).addClass("done");
}.bind(document.body));

@PetrToman
Copy link
Author

Y0ba: That will do the job. Thanks! 👍

@arantius
Copy link
Collaborator

This is a straightforward and backwards-compatible change, so I'd expect to include it.

@arantius arantius reopened this Apr 16, 2013
@arantius
Copy link
Collaborator

arantius commented Jun 7, 2013

Test case: https://gist.github.com/arantius/5729861

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants