Different ways to pass XML via jQuery AJAX

后端 未结 3 1913
萌比男神i
萌比男神i 2020-12-19 07:22

I\'m facing a problem to get return value (content-type: \"text/xml\"). I\'m able to get return value by direct access this URL:

https://[domain_name]/myfolder

3条回答
  •  温柔的废话
    2020-12-19 08:04

    I don't understand why you use the dataType ?

    What you want/need is contentType.

    From api.jquery.com :

    dataType (default: Intelligent Guess (xml, json, script, or html)) Type: String The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response.........

    contentType (default: 'application/x-www-form-urlencoded; charset=UTF-8') Type: String When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly pass in a content-type to $.ajax().............

    Hope this can help

提交回复
热议问题