XML : CORS post index file with XML call

I have some Ajax that makes a Cross Origin Resource call

   $("#inductive1").click(function (event) {      $.post(         "https://www.mysite.co.uk/folder/tests/Inductive/Test1/index.phtml",          function (data) {              $('.stage2').html(data);          }      );  });    

within the index.phtml file I have some Script that calls exam.xml

Script inside index.phtml

  ( function($, undefined) {                $(function() {                    var test = new Test({                        testName: "Inductive Test 1",                      dataURL : "/getresultshtml.php",                      sendEmailURL: "/sendresultsbyemail.php",                      contentFolder : "./",                      solutionURL: "../../../content/f/id/10/",                      userID: 0,                      courseItemID: 25,                      XMLFile: "exam.xml",                      isStandalone: false                  });                    test.start();                });          }(jQuery));    

However the xml file is trying to be called from the other server,

EG

  https://server1.com/exam.xml    

it should be

  https://myserver.com/exam.xml    

I have tried changing the JS to direct path as in

   XMLFile: "htttps:/myserver.com/exam.xml"    

but it is being read as

  https://server1.com/myserver.com/exam.xml    

how do I change the javascript so that it changes the root URL to myserver.com and not server1.com

No comments:

Post a Comment