Ich weiß, mehrere Abfragen wie unten in diesem Forum existieren, aber ich konnte nicht gefunden, was genau falsch ist in meinem Fall. jQuery Ajax nicht aufrufen C# Webmethod
$.ajax({
type: "POST",
url: "default.aspx/GetMaturityValues",
data: jsonParams,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
alert(response);
},
failure: function (response) {
alert(response.d);
}
});
[System.Web.Services.WebMethod]
public static string GetMaturityValues(string countryIDList, string xAxis, string yAxis, string bubbleSize)
{
//some code
}
Die Ausführung fließt, wird nicht in C# Code.
Die jsonParams:
var paramList = '';
var countryIDList = '1,2,3,5';
var xAxis = '1';
var yAxis = '2';
var bubbleSize = '6';
paramList += 'countryIDList' + '":"' + countryIDList;
paramList += 'xAxis' + '":"' + xAxis;
paramList += 'yAxis' + '":"' + yAxis;
paramList += 'bubbleSize' + '":"' + countryIDList;
paramList = '{' + paramList + '}';
var jsonParams = JSON.stringify(paramList);
* Fließt nicht in C# -Code * Was genau meinst du damit? Möchten Sie den Ajax in C# übersetzen? – RandomStranger
Der Ajax-Code ruft die beabsichtigte Methode nicht auf. – Rohit
Was bekommen Sie bei der Fehlerreaktion? – A3006