Topic: making an ajax request from a controller?

I have  a php script that I do not have time to convert to rails currently and would like to call it from the controller and then handle the data that it would output in the controller.

Would ajax be appropriate here? Is there a better way to do it?

I am searching for options here... thanks!

Re: making an ajax request from a controller?

Since this is all server side there's no need to get AJAX involved. You can use Net::HTTP to call the other server and get back the response.

If the PHP script is on the same server I'm sure there's even a better option.

Railscasts - Free Ruby on Rails Screencasts

Re: making an ajax request from a controller?

the script is on the same server - any idea of what that better option would be?
In any case I'll look at Net::HTTP, sounds interesting, thanks!

Re: making an ajax request from a controller?

Maybe use the "php" command line tool to run the script and return the output instead? I'm not sure if that will give you any better performance. It just seems silly going through HTTP when you have the script on the local.

Railscasts - Free Ruby on Rails Screencasts