我有这个需要拉入函数的 jQuery 对象,这可能吗?请看代码片段:
var input;
jQuery('.upload').live('click', function()
{
input = jQuery(this).find(".image-path");
tb_show(title, 'media-upload.php?type=image&TB_iframe=true');
return false;
});
window.send_to_editor = function( html )
{
if (input)
{
console.log(input); // works and defined at this point...
var data {
action: "doFunction"
};
jQuery.post( ajaxurl, data, function( response )
{
console.log(input); // does not work, not defined...why??
input.val(response); // this gives me input.val(response) is not a function
});
}
}