我想知道有没有办法在jQuery中停止代码执行,直到返回函数结果。在jQuery中暂停代码执行
functionName() {
//user inserts something
return user_insertion;
}
$(document).ready(function() {
//code before
if (var1.length > 1) result = functionName(data);
else result = [data: 1, data: 2, data: 3];
//code after, the one I want to pause execution of
//do something with result that user inserted
});
*“我想知道有没有办法在jQuery的停止代码执行,直到返回函数的结果。” * **电话** – 2014-10-09 14:35:38
如果你。阅读其他问题,他们都应该说你不应该这样做。 – Barmar 2014-10-09 14:36:13
欢迎使用异步编程。 – Andy 2014-10-09 14:37:51