I am trying to POST data using my sub domain using dojo, but dojo returns me this error.
XMLHttpRequest cannot load http://uri.com/ Origin http://sub.uri.com/ is
not allowed by Access-Control-Allow-Origin.
var form= dojo.byId("form");
dojo.connect(formSignIn, "onsubmit", function(event){
event.preventDefault();
var xhrArgs = {
form: form,
handleAs: "text",
load: function(data){
//dojo.byId("response").innerHTML = "Form posted.";
},
error: function(error){
//dojo.byId("response").innerHTML = "Form posted.";
}
}
var deferred = dojo.xhrPost(xhrArgs);
console.log(deferred);
});
this is my code. is there any available options in dojo.xhrPost that can enable me to access my main website so i can process my POST?
Take a look at the JSONP info on docs:
http://dojotoolkit.org/reference-guide/1.8/dojo/request/script.html
And also this tutorial:
http://dojotoolkit.org/documentation/tutorials/1.8/jsonp/
As a temporary solution, you can disable Chrome’s security to allow cross domain JavaScript requests with the
--disable-web-securityargument. See this question.