Hi,
I am a newbie to Backbone, My Rest Server Components Accept Only XML Requests, can Anybody show an example how do i send a xml to a rest api put request.
Asked
Active
Viewed 437 times
0
-
Backbone only works with JSON. – msapkal Mar 12 '14 at 06:02
1 Answers
0
Backbone uses JSON by default, so to use XML you need to overwrite Backbone.sync
. Take a look at this answer: How to override Backbone.sync?

Community
- 1
- 1

David Sulc
- 25,946
- 3
- 52
- 54
-
I did change the options.contentType="application/xml" but still the requestheader contentType is application/json. If somebody can show me an example of sending a xml as a payload that will be very helpful. – Vinay Mar 12 '14 at 12:38
-
The option you should be using is `dataType`, not `contentType`. See https://api.jquery.com/jQuery.ajax/ – David Sulc Mar 12 '14 at 13:13
-
-
-
Oops, sorry: to *send* XML you need to define the `contentType` attribute for the jQuery `$.ajax` call. Once you've serialized your data as XAML in the function call to `ajax` it should send the data as XML correctly. Also, check whether you need to add ".xml" to your url. – David Sulc Mar 13 '14 at 09:59
-