$.ajax({url: path_to_file, cache: false, success: function(html_result){
$("#window_" + this.id + "_cont_buffer").html(html_result);})
Now then. This function call is with in a function of a class. this.id is a property of said class. will this pass the function value of this.id into the string the anonymous function, or will it try to evaluate it when the function actually gets called, thus making no sense.
If this is not going to work how I want it to, can you recommend how I achieve this.
In the particular case of
$.ajax(),thiscan be specified using thecontextattribute. So, Matthew’s solution gives you thethisthat is specified in the function that you make the$.ajaxfunction call from.You can see the jQuery documentation for more information on setting the
thisfor thesuccesscallback.