我正在构建一个web应用程序,并且想知道如何处理AJAX调用中的错误。例如,如果用户输入了一些无效的数据(错误的电子邮件地址,用户已经存在),我希望能够从PHP抛出一个错误。我在这里看到了,您可以只使用一个JSON对象并处理来自JQuery的成功函数的错误报告,但这似乎不是正确的方法。在我看来,当出现错误时应该使用jQuery的错误函数。我想我是个很固执的人。//In my PHP file called from JQuery header(&qu
实际上,我希望在json的响应中显示它。{"message": "This action is unauthorized",这是我的PostController代码。authorization of user but how to make if else statement, if the post belong to the user it will show th