jQuery$.post関数を呼び出すイベントがあります。関数内で定義された変数にアクセスしたいの$.postですが、問題があります。
currentIdこの場合、変数にアクセスしたいと思います。
$('.notMatching').click(function(){
var currentId = this.id;
$.post("http://"+ document.domain + baseUrl +"/tables/demo.json", { id: this.id },
function(dat){
alert(currentId); //undefined
if(dat['result']==1){
$(this).parent().html('<input type="checkbox" class="first" value="'+this.id+'">');
}
}
);
});
それを行う方法はありますか?
ところで、このイベントは$(document).ready(function(){他の多くのイベントの中にあります。