You don't need to do any assignment by making anything global...
$('.notMatching').click(function(){
var that = this
$.post("http://"+ document.domain + baseUrl +"/tables/demo.json", { id: this.id },
function(dat){
alert(that.id);
if(dat['result']==1){
$(this).parent().html('<input type="checkbox" class="first" value="'+that.id+'">');
}
}
);
});
Assign your this
variable to that
and your that will be accessible within success call back of $.post