[英]JavaScript callback/closure/other
I have the below piece of code: 我有以下代码:
$("some_html_stuff").insertAfter('.some_element');
I then have other JS code which I need to be sure will execute AFTER the insertAfter function has finished its business. 然后我有其他JS代码,我需要确保在insertAfter函数完成其业务后执行。 How can a achieve this?
怎么能实现这个? I looked at closures and a bunch of other stuff, but I don't seem to be able to figure this out.
我查看了闭包和其他一些东西,但我似乎无法解决这个问题。
This is a synchronous command. 这是一个同步命令。 Nothing further will execute until it's finished.
在完成之前不会再执行任何操作。
$("some_html_stuff").insertAfter('.some_element');
// Do something after
.insertAfter
不是异步的,所以只需在该行代码后添加其他代码即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.