jqueryreplace:before&;后加载函数
我只想替换onclick上的文本,加载并替换为最终文本:jqueryreplace:before&;后加载函数,jquery,Jquery,我只想替换onclick上的文本,加载并替换为最终文本: $("#rebuild").click(function(){ $("#rebuild").replaceWith("in progress...").load("/rebuild").replaceWith("end !"); }); 已正确加载/重建脚本,但未显示最终替换。。。为什么? Load在函数完成后也接受函数的参数 $("#rebuild").click(function(){ $("#rebuild").r
$("#rebuild").click(function(){
$("#rebuild").replaceWith("in progress...").load("/rebuild").replaceWith("end !");
});
已正确加载/重建脚本,但未显示最终替换。。。为什么?
Load在函数完成后也接受函数的参数
$("#rebuild").click(function(){
$("#rebuild").replaceWith("in progress...").load("/rebuild", function(){
$(this).replaceWith("end !");
});
});
编辑:杜恩,有人比我抢先一步:p
Load在函数完成后也接受函数的参数
$("#rebuild").click(function(){
$("#rebuild").replaceWith("in progress...").load("/rebuild", function(){
$(this).replaceWith("end !");
});
});
编辑:杜恩,有人比我抢先一步:p
Load在函数完成后也接受函数的参数
$("#rebuild").click(function(){
$("#rebuild").replaceWith("in progress...").load("/rebuild", function(){
$(this).replaceWith("end !");
});
});
编辑:杜恩,有人比我抢先一步:p
Load在函数完成后也接受函数的参数
$("#rebuild").click(function(){
$("#rebuild").replaceWith("in progress...").load("/rebuild", function(){
$(this).replaceWith("end !");
});
});
编辑:Durn,有人比我抢先一步:p
load
是一种异步ajax方法。这意味着您的最终replaceWith
发生在来自服务器的数据放入元素之前。在同一个元素上链接replaceWith
充其量是不可靠的,因为一旦被替换,它就不再存在,因此下一个replace
如果您想在需要使用'load
$("#rebuild").click(function () {
$(this).html("in progress...").load("/rebuild", function () {
setTimeout(function(){
$(this).html( "end !");
}, 2000)
})
});
我使用了一个
setTimeout
来做最后的更改,所以它不是瞬时的,或者整个负载没有意义。还使用了html()
而不是replaceWith
,因此元素仍然存在,并且只有它;s内容更改加载是一种异步ajax方法。这意味着您的最终replaceWith
发生在来自服务器的数据放入元素之前。在同一个元素上链接replaceWith
充其量是不可靠的,因为一旦被替换,它就不再存在,因此下一个replace
如果您想在需要使用'load
$("#rebuild").click(function () {
$(this).html("in progress...").load("/rebuild", function () {
setTimeout(function(){
$(this).html( "end !");
}, 2000)
})
});
我使用了一个
setTimeout
来做最后的更改,所以它不是瞬时的,或者整个负载没有意义。还使用了html()
而不是replaceWith
,因此元素仍然存在,并且只有它;s内容更改加载是一种异步ajax方法。这意味着您的最终replaceWith
发生在来自服务器的数据放入元素之前。在同一个元素上链接replaceWith
充其量是不可靠的,因为一旦被替换,它就不再存在,因此下一个replace
如果您想在需要使用'load
$("#rebuild").click(function () {
$(this).html("in progress...").load("/rebuild", function () {
setTimeout(function(){
$(this).html( "end !");
}, 2000)
})
});
我使用了一个
setTimeout
来做最后的更改,所以它不是瞬时的,或者整个负载没有意义。还使用了html()
而不是replaceWith
,因此元素仍然存在,并且只有它;s内容更改加载是一种异步ajax方法。这意味着您的最终replaceWith
发生在来自服务器的数据放入元素之前。在同一个元素上链接replaceWith
充其量是不可靠的,因为一旦被替换,它就不再存在,因此下一个replace
如果您想在需要使用'load
$("#rebuild").click(function () {
$(this).html("in progress...").load("/rebuild", function () {
setTimeout(function(){
$(this).html( "end !");
}, 2000)
})
});
我使用了一个setTimeout
来做最后的更改,所以它不是瞬时的,或者整个负载没有意义。还使用了html()
而不是replaceWith
,因此元素仍然存在,并且只有它;内容的变化