Ok, this question probably has been asked quite a number of times, but I am fairly new to this technology and am not sure of what I should search for. So, if someone could either point me to a link where it has already been answered or provide the answer here, I would appreciate it.

Here is what I am trying to do.
On my web page, I have three choices for the user to pick from. After the user selects one of the checkboxes and clicks a submit button, I need to send a http request to a remote server to record the user's choices (actually it is an https that I am sending),.. so I need to send something like this.


The remote server responds with an xml response that looks like this:

<?xml version="1.0" encoding="utf-8"?>

So, I want to post the request, read the response (answer) back from the other server and display it on my page. So, my dilemma is as follows:

1) my understanding is that I cannot do this with AJAX using an XMLHttp object because it is on a remote server and it would violate some sort of same-domain security. Is that correct? If in fact I can do it in AJAX, how do I read the response back from the other server?

2) if I am correct in my assumption in 1) then what is the best way to accomplish this task?

Thanks in advance for any assistance anyone can provide.

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.

7 Years
Discussion Span
Last Post by vkennedy

You would setup a server-side script (using PHP or ASP or whatever your language is) that uses cURL or whatever your language uses to make and output the response. Then your AJAX call just points to your script.


`- Make request to RemoteServer.com/somefile.php
`- Output response from the request

`- Make request to myapifile.php
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.