服务器通过jquery发出警报响应 - c#

这是回应:

{"Message":"Authentication failed.","StackTrace":null,"ExceptionType":"System.InvalidOperationException"}

如何显示值为"Message"的警报框。
这对我不起作用:

error: function (data) { alert(data[0]); }

要么

error: function (data) { alert(data.Message); }

参考方案

尝试

error: function(header, status, exception) {
    alert(exception.Message);
}

取自http://api.jquery.com/jQuery.ajax/#jQuery-ajax-settings

jQuery Ajax PHP重定向到另一个页面 - php

JavaScript文件:$.ajax({ type: "POST", url: "ajax.php", data: dataString, success: function(r) { $("#div").html(r); } }); 我想在成功的情况下将页面重定向到new.php,所以在我使用a…

jQuery ajax()返回json对象,但未正确警告 - php

为什么无法使用data [0] .id返回ID? $(document).ready(function(){ $.ajax({ type: 'POST', dataType: "json", url: '<?php echo matry::base_to('tests/map_it'…

ajax:从json数组中提取json对象 - javascript

JSON(来自api的内部数组):[{"id":"001", "name":"john", "age":"40"}, {"id":"002", "name":"jane&…

jQuery ajax发布电子邮件字段 - javascript

我不确定为什么我无法发布电子邮件字段的内容,这是我的代码。<html> <head> <title></title> <script src="//code.jquery.com/jquery-1.11.2.min.js"></script> </head>…

jQuery Ajax PHP只工作一次 - php

我有以下jQuery $("button#submit").click(function(){ $.ajax({ type: "POST", url: "process.php", data: $('form.contact').serialize(), success: fun…