【发布时间】:2011-11-23 17:11:45
【问题描述】:
function Activity() {
this.LoadFile = function (path, targetElement) {
$.ajax({
url: path,
dataType: 'html',
success: function (data) {
targetElement.html(data);
}
});
};
this.LoadFile = function (path, targetElement, onSuccess) {
$.ajax({
url: path,
dataType: 'html',
success: function (data) {
targetElement.html(data);
onSuccess(data);
}
});
};
}
如果我尝试传递 2 个参数,我会得到 onSuccess is not a function 所以我想这不起作用。是否可以在 javascipt 中使用重载?
【问题讨论】: