dinesh707
dinesh707

Reputation: 12592

How to request from a different server URL using JavaScript

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??

Upvotes: 1

Views: 1070

Answers (3)

dinesh707
dinesh707

Reputation: 12592

I created a iframe dynamically. It seems working.

Upvotes: 0

glutorange
glutorange

Reputation: 993

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.

Upvotes: 0

NullUserException
NullUserException

Reputation: 85468

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.

Upvotes: 1

Related Questions