function validateHistoryId(input) {
$.getJSON('request.php', {"action": "historyExists", "history_id" : input.value},
function(data) {
console.log(input.value);
}
);
}
Run Code Online (Sandbox Code Playgroud)
我从javascript函数使用jQuery ajax调用.我尝试了上面的代码并且它可以工作,但我不知道将来是否会引起任何问题.
我想知道,ajax回调函数可以看到它的父函数的变量吗?这样做是不好的做法?