PHP trigger AJAX error code without using array

前端 未结 4 2154
迷失自我
迷失自我 2021-01-06 08:33

I want to be able to get a PHP script called via AJAX to return with an error code that the jQuery AJAX handler error: will handle. I don\'t want to use a JSON

4条回答
  •  南笙
    南笙 (楼主)
    2021-01-06 08:59

    Ajax transmission does not have to be JSON. It can be xml, json, script, or html. By default AJAX uses XML (the X from AJAX stands for that). I see that you are using jQuery. If you are using ajax method you have a dataType parameter that you can modify.

    As you speak of it JSON is one of cleanest in my opinion, but if you mean simple you can use text instead.

提交回复
热议问题