What exactly triggers jQuery ajax success?

萝らか妹 提交于 2019-12-05 08:05:22

The success handler will be triggered if

  • The response has HTTP status code 200 (yours does)
  • jQuery is able to deserialize the response according to the Content-Type header in the response (or the dataType option, if you provide it, which overrides the Content-Type header)

So for instance, if your response had a Content-Type header of application/json or application/xml, the response you've quoted won't trigger the success handler because it cannot be successfully deserialized as either JSON or XML.


Your latest edit (as of this writing) reveals the problem:

Here are the response headers from jQuery getAllResponseHeaders()

...

Content-Type: text/xml; charset=utf-8

I suspect your response isn't valid XML, so jQuery can't deserialize it as XML, so it's failing.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!