2

Assumption - people in my office are not that smart / I dont want to use any server port for my below utlity :)

  1. My Html file resides in the local disk (consider cross domain refrences constraint hile sugessting the solution)
  2. When double clicked , HTML form opens and asks for entering order number
  3. when entered and form is submitted , server responds back with details in the form of XML Note : for submitting i used html POST method , Upto 3rd step everything works fine and i get the server response xml as next page on browser.

Now, How to parse this response xml so that only desired data is shown on the next page when form is submitted on 3rd step , bypassing the raw response from server.

JS submit function

function submit1() // called when i click on submit button on my form
{
 var actionFianl = "http://URL(other data is given as form post method)";
document.form1.action = actionFianl;
document.form1.submit();
      }

And XML data is displayed , starting with

<?xml version="1.0" encoding="UTF-8" ?> 
2
  • 1
    You shouldn't leave in internet's immortal memory sentences like your first one... Oct 29, 2012 at 17:03
  • It's too late, google already came along, took a picture and now you can forever look it up in the interwebs archives. All Hail Google!
    – Ryan
    Oct 29, 2012 at 19:50

1 Answer 1

0

So if I understand your issue, Ajax calls are out of the question due to cross domain trouble. I remember doing something like this and found that Safari worked, but Chrome did not like it, due to cross origin policy. This was a while back and I am not certain if it was the same problem.

If I understand you correctly you want to have the XML in Javascript, instead showing the raw data independently. What comes to mind if Ajax can't be used, is having two files. The current one will have the form included and gets the XML. The second file containing the first file in an iframe, which reads the content of the iframe, when the form is submitted, and is able to read the XML.

Another solution might be something like node-webkit depending on the scale of your application. Node-webkit is an executable for windows/mac/linux which ships Webkit and Node, and runs them in a single context. Maybe you could get the XML through the Node server instead doing it through a vanilla form submit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.