title: AJAX submit form to remote URL and extract URL from XML reponse
body: <p>I am new to JavaScript and Ajax.</p>
  
  <p>I have a form which posts to remote url and returns a XML response containing some data and a URL. I need to extract the url and redirect to the URL in the XML response.</p>
  
  <p>Here is my form</p>
  
  <pre><code>&lt;form target="_blank" action='https://requesturl.co.uk/requestservice.asmx/Request_v4' method="POST"  &gt;
  &lt;input type='hidden' value='' name='AffiliateID' /&gt;&lt;input type='hidden' value='' name='AffiliatePW' /&gt;&lt;input type='hidden' value='' name='ReqMode' /&gt;&lt;input type='hidden' value='' name='ReqTotalTimeout' /&gt;&lt;input type='hidden' value='' name='ReqLenderTimeout' /&gt;&lt;input type='hidden' value='' name='ReqLoanAmount' /&gt;&lt;input type='hidden' value='' name='AppTitle' /&gt;&lt;input type='hidden' value='' name='AppFirstName' /&gt;&lt;input type='hidden' value='' name='AppLastName' /&gt;&lt;input type='hidden' value='' name='AppEmail' /&gt;&lt;input type='hidden' value='' name='AppDOBDay' /&gt;&lt;input type='hidden' value='' name='AppDOBMonth' /&gt;&lt;input type='hidden' value='' name='AppDOBYear' /&gt;&lt;input type='hidden' value='' name='AppHomePhone' /&gt;&lt;input type='hidden' value='' name='AppWorkPhone' /&gt;&lt;input type='hidden' value='' name='AppMobilePhone' /&gt;&lt;input type='hidden' value='' name='AppPostCode' /&gt;&lt;input type='hidden' value='' name='AppHouseNumber' /&gt;&lt;input type='hidden' value='' name='AppStreet' /&gt;&lt;input type='hidden' value='' name='AppTown' /&gt;&lt;input type='hidden' value='' name='AppCounty' /&gt;&lt;input type='hidden' value='' name='EmpIncomeType' /&gt;&lt;input type='hidden' value='' name='EmpEmployerName' /&gt;&lt;input type='hidden' value='' name='EmpTimeAtEmployer' /&gt;&lt;input type='hidden' value='' name='EmpNetMonthlyPay' /&gt;&lt;input type='hidden' value='' name='EmpPayFrequency' /&gt;&lt;input type='hidden' value='' name='EmpDirectPayment' /&gt;&lt;input type='hidden' value='' name='EmpNextPayDay' /&gt;&lt;input type='hidden' value='' name='EmpNextPayMonth' /&gt;&lt;input type='hidden' value='' name='EmpNextPayYear' /&gt;&lt;input type='hidden' value='' name='EmpFollowingPayDay' /&gt;&lt;input type='hidden' value='' name='EmpFollowingPayMonth' /&gt;&lt;input type='hidden' value='' name='EmpFollowingPayYear' /&gt;&lt;input type='hidden' value='' name='EmpNINumber' /&gt;&lt;input type='hidden' value='' name='BankAccount' /&gt;&lt;input type='hidden' value='' name='BankSortcode' /&gt;&lt;input type='hidden' value='' name='BankDebitCard' /&gt;&lt;input type='hidden' value='' name='AppAddressYears' /&gt;&lt;input type='hidden' value='' name='AppAddressMonths' /&gt;&lt;input type='hidden' value='' name='AppHomeStatus' /&gt;&lt;input type='hidden' value='' name='ReqConsent' /&gt;&lt;input type='hidden' value='' name='ReqIPAddress' /&gt;&lt;input type='hidden' value='' name='ReqAgent' /&gt;&lt;input type='hidden' value='' name='ReqMarketingOptIn' /&gt;&lt;input type='hidden' value='' name='ReqDomain' /&gt;
  &lt;input type="submit" value="Invoke" class="button"&gt;
  </code></pre>
  
  <p>The XML response is</p>
  
  <pre><code>&lt;RequestResult&gt;&lt;Result&gt;Accepted&lt;/Result&gt;&lt;FailureReasons/&gt;&lt;AcceptedLender&gt;LendingStream&lt;/AcceptedLender&gt;&lt;RedirectURL&gt;http://redirecttothisURL.com/testing.htm&lt;/RedirectURL&gt;&lt;PPDReference&gt;6524845&lt;/PPDReference&gt;&lt;/RequestResult&gt;
  </code></pre>
  
  <p>after some research it looks like Jquery would be best to do this but I'm getting confused if the fact its posting to remote URL will create problems due to browsers not allowing it.</p>
  
  <p>Any help or ideas would be greatly appreciated.</p>
  
  <p>Thanks</p>