xmlhttprequest - dojo/request/xhr returning xml instead of json -


i'm using simple dojo xhr request:

require(["dojo/query", "dojo/on", "dojo/dom-style", "dojo/request/xhr", "dojo/domready!"],             function (query, on, domstyle, xhr) {                  xhr("api/products", {                     handleas: 'json'                 }).then(function (data) {                     console.log('got data dojo xhr', data);                 }, function (err) {                     console.log('error dojo xhr', err);                 });             }         ); 

this works fine, data returned xml not json.

however, same call in jquery returns data in json.

when @ headers, jquery call shows: content-type application/json; charset=utf-8, dojo call shows: content-type application/xml; charset=utf-8

i added:

headers: { "content-type": "application/json; charset=uft-8" } 

to xhr parameters, still no luck, still returns xml.

what gives? how tell dojo xhr handle json? i'm using dojo 1.8.3.

the server doesnt behvae itself. check using firebug dojo , jquery requesting when xhr. there has param tells server dojo or jquery. change parameter.

dojo , jquery same, based on js , both use xhr. please consider posting exact request information both.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -