ajax多个data传值 (2013-01-22 11:31:52)转载▼
标签: 杂谈
post提交方式下的多参数传递:
var jsonStr;//全局参数
$.ajax({
type: “POST”,
dataType: “json”,
url: “/validate.html”,
data: “wyuser=”+wyuser+”&txqq=”+txqq,
success: function (data) {
jsonStr = data;
},
eror: function (data) {
alert(“请求超时!”)
}
});
get提交方式下的多参数传递:
function fsubmit(){
var item =
(
“
i
n
p
u
t
:
r
a
d
i
o
:
c
h
e
c
k
e
d
”
)
;
v
a
r
c
h
e
c
k
e
d
v
a
l
u
e
=
i
t
e
m
.
v
a
l
(
)
;
v
a
r
f
q
q
=
(‘#FVotedQQ’).val();
var getaward = $.ajax({
url: “
http://changancx20.act.qq163.com/c/vote/add
“,
data:”FVotedQQ=”+fqq+”&kindid=”+checkedvalue,
async: false
}).responseText;
eval_r(‘var data = ‘+getaward);
alert(data.message);
return false;
}
data: “{username:’” + username + “’,pwd:’” + pwd + “’}”,