How can I access the value of $(this) after success: function() when using jquery? No matter what I\'ve tried, it appears I cant do it.
$(\'.add\').click(functio
"this" inside your ajax success is not the same "this" outside.
Different scopes...
There is a nice solution for this question.
$('.add').click(function() {
var that = $(this);
//do whatever you want :]
$.ajax({
type:"GET",
url:"/",
data:data,
dataType: 'json',
beforeSend:function(html){
//Nothing here right now
},
success: function(){
that.parent("div").after("I'm the new one.");
},
});
});