Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试将参数传递给ajax.load(). 我想this从父函数传递到ajax.load(). 我想在里面使用这个
ajax.load()
this
这是我的代码:
ajax.done(function(msg) { jQuery(this).children('p').append(msg); });
您可以定义一个变量,该变量将在闭包中保存所需的值:
var $this = $(this); ajax.done(function(msg) { $this.children('p').append(msg); });