关于js执行顺序解决思路

WBOY
Release: 2016-06-13 13:52:49
Original
1127 people have browsed it

关于js执行顺序
代码:,点击按钮,会执行js中的方法a()和b(),现在想让方法b()等待方法a()执行完再执行,该如何实现 。 (方法a()其实是ajax调用的方法,方法b()执行需要方法a()的返回值)

------解决方案--------------------
把b()放在a()的if(xmlHttp.status == 200)里面。
------解决方案--------------------
把b()函数放a()函数最后面就行!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template