0

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?

reylimjr
  • 311
  • 6
  • 13

1 Answers1

0

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-security argument. See this question.

Community
  • 1
  • 1
Aram Kocharyan
  • 19,179
  • 11
  • 69
  • 93
  • thank you for your answer, that might be a solution. but i am looking for a code that can user {$_POST}. the dojo-request-script only accepts get as read in http://dojotoolkit.org/reference-guide/1.8/dojo/request/script.html. – reylimjr Jan 11 '13 at 07:40