有效Ajax案例
2021-05-29 11:00
标签:for content ica input orm art word read username $(document).ready(function(){$("input:submit").click(function(){$.ajax({ type: "POST", url: "Ajax", contentType: ‘application/x-www-form-urlencoded;charset=utf-8‘, data: {name:$("#username").val(), pwd:$("#password").val()}, dataType: "html", success: function(data,status){ alert("数据: \n" + data + "\n状态: " + status); }, error:function(data,status){ alert("数据: \n" + data + "\n状态: " + status); }, });});}); 有效Ajax案例 标签:for content ica input orm art word read username 原文地址:https://www.cnblogs.com/bulter/p/14738683.html
function commit(){
$.ajax({
type: ‘GET‘,
// dataType: ‘json‘,
async: true,
url: "editArticleSubmit1",
data: {
name:$("#name").val(),
sex:$("#sex").val(),
age:$("#age").val(),
purpose:$("#purpose").val(),
workAge:$("#workAge").val(),
content:$("#content").val(),
},
success: function (data) {
// obj=eval(‘(‘+obj+‘)‘);//这段代码就是将字符串转换成json格式
/*var name = this.data.name;
var sex = this.data.sex;
var age = this.data.age;
var purpose = this.data.purpose;
var workAge = this.data.workAge;
var content = this.data.content;*/
alert("投递成功");
}, error: function (msg,status) {
alert(msg+status);
return;
}
});
// var a=$("#massage").val();
// alert(a)
}
上一篇:CSS学习07-复合选择器
下一篇:顺丰电子面单JSON请求格式