所以我试图实现以下目标,但我无法弄清楚如何使这项工作.
$.ajax({
url: "whatever.php",
method: "POST",
data: { myVar: "hello" },
success: function(response) {
console.log('received this response: '+response);
console.log('the value of myVar was: '+data.myVar); // <<<< data.myVar is not accessible from here
console.log('the value of myVar was: '+myVar); // <<<< myVar is not accessible from here
}
});
Run Code Online (Sandbox Code Playgroud)
是否有访问的价值方式myVar的.success()功能?我可以以某种方式获取data在此.success()函数中在此ajax请求中发送的原始对象吗?
希望你的解决方案.谢谢!