JavaScript code I'm starting with:
function doSomething(url) {
$.ajax({
type: "GET",
url: url,
dataType: "xml",
success: rssToTarget
});
}
我要使用的图案:
//where elem is the target that should receive new items via DOM (appendChild)
function doSomething(url, elem) {
$.ajax({
type: "GET",
url: url,
dataType: "xml",
success: rssToTarget(elem)
});
}
我不认为我能让回拨这样起作用,对吗?合适的式样是什么?我不想使用全局变量来临时保存elem
或elem名称.