views:

32

answers:

3

I need to send some of my data into another server. Actually to post into facebook. So here i already have an API which works by an URL.

So if i set the parameters from the URL and if i try it in web browser it works. But when i try it as a AJAX call it do not work. (Because its not hosted in the same server as my web pagers are).

Is there any way to send this URL in the background??

+1  A: 

You cannot. For security reasons, Javascript can't initiate requests to sites in different domains.

The only way to do that would be query your own server and have it query the external API, and then respond to your page.

NullUserException
Any way to make it happen. I dont need to do it exactly as a AJAX call. But just need to do it in background.
dinesh707
You have to "relay" it to the same domain where the page is at. This can be done in the background. It doesn't matter if you use XMLHTTPRequest or not; JS can't access pages in another domain.
NullUserException
A: 

You will have to write a proxy routine on your own domain that communicates with your JS on the one hand and with third party domain (Facebook) on the other.

Daniel
A: 

I created a iframe dynamically. It seems working.

dinesh707