jQuery Ajax call No element found issue

前端 未结 6 1984
清歌不尽
清歌不尽 2020-12-17 09:33

I am getting a javascript error on firefox 3.5, when trying to call an ajax method.

Please find the error below:

XML Parsing Error: no element found          


        
6条回答
  •  臣服心动
    2020-12-17 09:42

    I've come across an alternative cause of this - might help someone.

    If you make a $.ajax request (in my case a PUT request) that returns a 200 header but no body content I've seen this same XML Parsing error message occur - even when the dataType is set to json.

    (At least) two solutions work:

    • Make all API PUT requests return some content, or
    • Return a 204 'No Content' header instead (what I ended up doing)

提交回复
热议问题