猿问

ajax中status返回结果是0是怎么回事?

window.onload=function(){
			var request=new XMLHttpRequest();
			request.open("GET","http://study.163.com /webDev/couresByCategory.htm",true);
			request.send();
			request.onreadystatechange=function(){
				if (request.readyState===4&&request.status===200) {
					var data=JSON.parse(request.responseText);
					document.getElementById("name").innerHTML=data.name;
				}else{
					alert("发生错误"+request.status);
				}
			}
		}


oldwan
浏览 1790回答 1
1回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答