search
HomeBackend DevelopmentPHP Tutorial 关于js执行顺序解决思路

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

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

Statement
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
html怎么设置button大小及颜色html怎么设置button大小及颜色Mar 05, 2021 pm 05:16 PM

在html中,可以使用width和height属性来设置button元素的大小,使用background-color属性来设置button元素的颜色,具体语法为“button{width:宽度值;height:高度值;background-color: 颜色值;}”。

HTML中onclick怎么用HTML中onclick怎么用Nov 13, 2023 am 10:07 AM

通过将onclick属性设置为一个JavaScript函数或行为,可以在用户点击某个元素时执行相应的操作。无论是直接在HTML标签中使用onclick属性,还是通过JavaScript动态地添加和修改onclick属性,都可以实现点击事件的处理。

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code<form name="myform"

react中怎么禁止button渲染react中怎么禁止button渲染Jan 19, 2023 pm 01:58 PM

react中禁止button渲染的方法:1、打开相应的js代码文件;2、找到“const flags = true;<Button disabled={flags}/>”并将其中的“true”值修改为“false”即可禁止button。

html中button标签的用法html中button标签的用法Feb 24, 2021 pm 02:16 PM

在html中,button标签用于定义一个按钮,在元素内部可以放置内容,比如文本或图像等;使用语法为“<button type="button" onclick="js代码">按钮</button>”,button标签的属性和js代码结合可以实现交换效果。

不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没有关问题不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没有关问题Jun 13, 2016 am 10:15 AM

不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没问题。<?phpfunction down_file($file_name,$file_sub_dir){//为防止乱码使用函数iconv$file_name=iconv("utf-8","gb2312",$file_

为什么小弟我在php上写的这个代码,在浏览器上什么都不显示为什么小弟我在php上写的这个代码,在浏览器上什么都不显示Jun 13, 2016 am 10:24 AM

为什么我在php上写的这个代码,在浏览器上什么都不显示啊<?php   if(isset($_POST['Submit'])&& $_POST['Submit']=="登陆"){   $user=$_POST['user']; $pass=$_POST['pass']; if(empt

图片消失怎么解决图片消失怎么解决Apr 07, 2024 pm 03:02 PM

图片消失如何解决先是图片文件上传$file=$_FILES['userfile'];  if(is_uploaded_file($file['tmp_name'])){$query=mysql_query("INSERT INTO gdb_banner(image_src ) VALUES ('images/{$file['name'

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft