日期:2014-05-16 浏览次数:20623 次
function Say() {
var str = $("#txt1").val();
var str2 = $("#txt2").val();
$.ajax({
type: "post",
url: "Default.aspx/SayHello",
contentType: "application/json;charset=utf-8",
dataType: "json",
data: "{'str':'我是','str2':'XXX'}",
//data:"str:"+$("#txt1").val()+",str2:"+$("#txt2").val()+"",
//data: "{'str':'" + str + "','" + str2 + "':'XXX'}",
success: function (data) {
//返回的数据用data.d获取内容
alert(data.d);
},
error: function (err) {
alert(err);
}
})
}
[WebMethod]
public static string SayHello(string str, string str2)
{
return str+str2;
}
function Say() {
var str = $("#txt1").val();
var str2 = $("#txt2").val();
$.ajax({
type: "post",
url: "Default.aspx/SayHello",
contentType: "applicati