jquery ajax post/get 例子详解

栏目: 编程语言 · JavaScript · 发布时间: 9年前

内容简介:jquery ajax post/get 例子详解

jquery ajax post/get 例子详解

总是记不住,留一个做为备忘。

function test(){
	$.ajax({
		//提交数据的类型 POST GET
		type:"POST",
		//提交的网址
		url:"testLogin.aspx",
		//提交的数据
		data:{Name:"sanmao",Password:"sanmaoword"},
		//返回数据的格式
		datatype: "html",//"xml", "html", "script", "json", "jsonp", "text".
		//在请求之前调用的函数
		beforeSend:function(){$("#msg").html("logining");},
		//成功返回之后调用的函数
		success:function(data){
			$("#msg").html(decodeURI(data));
		}   ,
		//调用执行后调用的函数
		complete: function(XMLHttpRequest, textStatus){
			alert(XMLHttpRequest.responseText);
			alert(textStatus);
			//HideLoading();
		},
		//调用出错执行的函数
		error: function(){
		//请求出错处理
		}
	});

}

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。

The CS Detective: An Algorithmic Tale of Crime, Conspiracy, and

The CS Detective: An Algorithmic Tale of Crime, Conspiracy, and

Jeremy Kubica / No Starch Press / 2016-8-15 / USD 13.74

Meet Frank Runtime. Disgraced ex-detective. Hard-boiled private eye. Search expert.When a robbery hits police headquarters, it's up to Frank Runtime and his extensive search skills to catch the culpri......一起来看看 《The CS Detective: An Algorithmic Tale of Crime, Conspiracy, and 》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

随机密码生成器
随机密码生成器

多种字符组合密码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具