ASP.NETAJAX Post错误
VB.NET WebMethodASP.NETAJAX Post错误,asp.net,ajax,vb.net,jquery,Asp.net,Ajax,Vb.net,Jquery,VB.NET WebMethod jQuery $(".lnkpro").click(function () { $.ajax({ type: "POST", url: "uygulamalar.aspx/Getir", data: '{name: "1234"}', contentType: "application/json; charse
jQuery
$(".lnkpro").click(function () {
$.ajax({
type: "POST",
url: "uygulamalar.aspx/Getir",
data: '{name: "1234"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (sonuc) { $(".resimler").html(sonuc.d); },
error: function () { alert("error") }
});
});
他在阿卡达拉的花园里散步
错误在哪里?使用此脚本:
<System.Web.Services.WebMethod()> _
Public Shared Function Getir(ByVal name As Integer) As String
Return name & " asdalo"
End Function
删除“{name:1234}”中的单引号,那么我恐怕不支持非英语使用者@Satya。我相信OP需要删除双引号,因为值被解释为string@YuriyRozhovetskiy,这不是应该是{name:1234}而不是{name:1234}吗?我做了,但问题没有解决
var data={
name : 1234
};
$(".lnkpro").click(function () {
$.ajax({
type: "POST",
url: "uygulamalar.aspx/Getir",
data: JSON.stringify(data),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (sonuc) { $(".resimler").html(sonuc.d); },
error: function () { alert("error") }
});
});