AnsweredAssumed Answered

cross domain

Question asked by Nick.xu@vancouver.ca on Sep 13, 2018

I'm using JsonRest to query data from other server, but I got error: message: "The requested resource does not support http method 'OPTIONS'.

I can open the url from another tab. I checked the configuration file of rest service on the server, it did set "Access-control-allow-orgin" to "*".

 

I did the same test with dojo/rest and it generated the same error. Also, if works when use jquery ajax.

 

 

my code looks:

//using dojo/request/xhr

xhr(this.config.locationSearchUrl + "?description=8&type=address", {
method : "POST"
}).then(function(data) {
// Do something with the handled data
console.log("%o", data);
}

 

//jsonRest

this.jsonRest = new JsonRest({
target: this.config.locationSearchUrl,
headers: {
"X-Requested-With": "null"

},
type:"GET"
});

 

//jquey ajax which works

$.ajax(this.config.locationSearchUrl + "?description=8").then(function(returns){
console.log("%o", returns)
})

 

thanks for any help

 

Outcomes