Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8571097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:42:29+00:00 2026-06-11T18:42:29+00:00

Possible Duplicate: $.ajax context option I’ve got some code that looks like this: $.post(self.baseUrl

  • 0

Possible Duplicate:
$.ajax context option

I’ve got some code that looks like this:

$.post(self.baseUrl + 'api/method',
        {param1: data},
        function (response) {
            // Do something
        });

I want to pass a reference to the self object through to the callback, which I imagined would be something like this:

$.post(self.baseUrl + 'api/method',
        {param1: data},
        function (response, self) {
            // Do something
        });

However, it doesn’t work like this, the jQuery documentation doesn’t show a way that would make this possible and a cursory Google search hasn’t turned up anything. Is this possible, and how can I do so?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:42:31+00:00Added an answer on June 11, 2026 at 6:42 pm

    If you use the $.ajax method you can specify a context:

    $.ajax({
        type: "post",
        context: self,
        data: {param1: data},
        success: function (response) {
            console.log(this); // now 'this' refers to self
    
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: jquery ajax call taking too long or something for some reason this
Possible Duplicate: return AJAX callback return I have made a JQuery code using AJAX,
Possible Duplicate: jQuery: How to stop AJAX function escaping JSON string used to POST
Possible Duplicate: Kill Ajax requests using JavaScript using jQuery Here is the simple code
Possible Duplicate: How to put this code in v3 instead v2 map I have
Possible Duplicate: Jquery:: Ajax powered progress bar? I need to create some kind of
Possible Duplicate: How to hide ajax requests from firebug console? I would like to
Possible Duplicate: jQuery ajax() vs get()/post() what is the difference between jQuery ajax() and
Possible Duplicate: AJAX request fails to process $_SESSION variable I have some strange issue
Possible Duplicate: jQuery ajax return value I have this jQuery script: $('#headerSubmit').click(function() { var

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.