Ich verstehe nicht, warum meine benutzerdefinierte Rückruffunktion immer ausgelöst wird. Wenn ich diese Rückruffunktion lösche, wird meine Erfolgsrückruffunktion ausgelöst.Jquery Ajax Immer Fehler ist trigerred
Ich lese im Internet, dass dies ein Codierungsproblem, aber in meinem Fall glaube ich nicht so.
Hier mein Code:
Im Client
myFunction = function() {
$.ajax({
url: customUrl,
type: "POST",
data: JSON.stringify(buildDatata("custom")),
contentType: "application/json",
dataType: "json",
success: mysuccess,
error: myerror("Error")
});
}
buildDatata= function (action) {
return data = {
"Action": action,
"SubscriptionInfo":
{
"SiteId": CurrentSiteId,
"WebId": CurrentWebId,
"ListId": CurrentListId,
"ItemId": CurrentItemUniqueId,
"SubscriptionDate": new Date().toUTCString(),
"SubscriptionType": GetTypePage()
}
}
}
In meinem Server:
private void HasSubscripted(HttpContext context, BookmarkAction bookmarkAction)
{
bool result = true;
SendResponse(context,
new
{
isSubscripted = result
}
);
}
protected void SendResponse(HttpContext context, object jsonResponse)
{
JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
context.Response.Clear();
context.Response.ContentType = "application/json";
context.Response.Write(jsonSerializer.Serialize(jsonResponse));
context.Response.End();
}
Was mache ich falsch?
Sie eine Funktion aufrufen .... Was es gibt – epascarello
Dank der Ereignis-Listener zugewiesen wird, so viel, ich bin dub :) – TWEESTY