Ajax request from an external web site to a controller action

Hi, I need to write a little JS file (to place in not rails web site)
in which I need to make an ajax call
like this http_request.open(‘GET’, url, true); where URL is a rails
url of my web site (http://my-site.com:3000/controller/action/par1/
par2) and return a string in the web site that start the request and
put in a dedicated DIV.
The JS should be added to any web-site.

Can you help me!?

Thanks!!!
Bye!

Please!! Help me!!

Yo can’t write an ajax request for a different website.
For example, if you are on www.example.com you can’t make a request to
www.google.com.
There are other solutions if this is the problem

Thanks a lot. Can you tell me any solutions? How I can make a req for
a different web site??

On 17 Ott, 21:25, “[email protected][email protected]

You cannot. The browser will not allow it.

–Michael

Niko P. wrote:

Hi, I need to write a little JS file (to place in not rails web site)
in which I need to make an ajax call
like this http_request.open(‘GET’, url, true); where URL is a rails
url of my web site (http://my-site.com:3000/controller/action/par1/
par2) and return a string in the web site that start the request and
put in a dedicated DIV.
The JS should be added to any web-site.

What you’re describing is functionality along the lines of a widget.
There’s a few ways to do it, but the easiest for the remote site is
usually an iframe.

Investigate how widgets work, an you’ll get some ideas.

– gw