Quick Jquery: How to set context in $.ajax()


Today working on a simple ajax jquery call, I was searching for setting context in ajax function suddenly one my javascript master came and wrote a code below, and it was done.

Its look like this:

1
2
3
4
5
6
7
8
9
10
         $('#click_me').function(){
            $.ajax({
               type: 'POST',
               data: 'value=34',
               context: $(this),
               success: function(resp){
                            $(this).next().html(resp);
                          }
             });
         });

And its all done!



Comments

09.11.10

… and what is the context for?