jquery 回调函数无返回值,提示 xml5619: 文档语法不正确
在使用 jquery异步提交表单数据并处理页面时,回调函数未能获得返回值,控制台提示错误:xml5619: 文档语法不正确。
此错误通常与服务器返回的数据格式不正确有关。浏览器期望收到 jsonp、json 或 xml 格式的数据,但在你的情况下,服务器可能返回了不符合这些规范的内容。
domessage.php
echo json_encode(array("success" => true, "message" => "数据已保存"));
formmessage.php
$.ajax({ ... success: function (response) { if (response.success) { alert(response.message); } else { alert("数据保存失败,请检查服务器端错误。"); } } });