What is the jQuery $(this) referring to in this specific code fragment?

jquery

Solution

`this` refers to the `$.ajax()` settings object. To get what you want, you'll need to maintain `this` by using the `context` option like this:

$.ajax({
  context: this,
  type: "GET",
  url: "projectitems.php",
  data: dataString,
  cache: false,
  success: function(html) {
    $(this).closest(".resultsItems").html(html);
  }
});

Problem

``` $(document).ready(function() { $(".po").click(function(){ var po = $(this).text(); var dataString = 'po='+ po; $.ajax ({ type: "GET", url: "projectitems.php", data: dataString, cache: false, success: function(html) { $(this).closest(".resultsItems").html(html); } }); }); }); ``` The line `$(this).closest(".resultsItems").html(html);` what exactly is (this) referring to? I'm trying to append the returned ajax result to a `<td>` called .resultsItems but only to the one below the intial clicked selector? Is this possible? Just to make it clear i'm not asking what (this) means in jQuery, i'm asking what (this) is referring to in my code above!

Original source