views:

396

answers:

2

How do I load an external http xml request with jquery?

Below is a url when pasted into a web browser like firefox, an xml document is shown.

This is for the CPanel XML API.

http://hostingz.org:2086/xml-api/createacct?username=WeAreWatching&plan=hostingz%5FFH5&ip=n&cpmod=x3&password=changeme&contact [email protected]&domain=thewawblog&useregns=0&reseller=0

How do I make this work in jquery?

    <head>
    <script type="text/javascript">
       $(document).ready(function(){

$.ajax({
    type: "GET",
url: "http://hostingz.org:2086/xml-api/createacct",
dataType: "html",
success: function(xml) {
    $("#final").append("<img src=\"icons/tick.png\" align=\"left\">Account Creation Successful!<br>The free account was created successfully!!<br><br>The account details have been sent to the email.<br><br>");
}
    });
     });

   </script>
   </head>
A: 

The browser denies access to external sites to prevent cross site scripting. You can use the Google API to make such requests, or use server side code.

Time Machine
A: 

Here's more info on using a proxy.

Andy Gaskell