Ajax know basis

Ajax means Asynchronous JavaScript and XML, is a web page without reloading the whole technical part of the page can be updated.
Back and Favorites bookmark feature uses Ajax's biggest advantage is that we can maintain data without updating the entire page of the premise, but it may break the browser's

background needed to use JSON for data interaction

基础的Ajax(修改密码)
$.Ajax{
	type:"post",	//请求方式
	url:path+地址(请求的servlet的地址),	//请求地址
	data:{method:"pwdmodify",/*oldpassword旧数据,修改密码时的原密码*/oldpassword:password.val()},	//传递的传输(需要进行ajax操作的数据)
	success:function(data){		//返回成功
		if(data.result.equals("true")){
			//输出正确数据。。。
		}else if(data.result.equals("false")){
			//输出错误数据。。。
		}slse if(data.result.equals("sessionerror")){
			//session失效,需要重新登录。。。
		}slse if(data.result.equals("zeroerror")){
			//输入框为空
		}
	}
	
	error:function(data){	//返回失败
		//请求错误(异常)数据传输错误
	}
}
Published 61 original articles · won praise 0 · Views 2167

Guess you like

Origin blog.csdn.net/sabstarb/article/details/104956017