helpers in rails to get URL using AJAX

Hello all, I'm trying to get (using Ajax) whatever URL the user clicks on the page. Also, I want to store the results from the URL request in a JS variable. Did somebody know helper in Rails which allow me to do that ? Thanks, Thib

Well, I have found some interesting code : (Prototype JavaScript Framework | Introduction to Ajax)

Not sure, but I think it's a general restriction of XMLHTTPRequest in browsers in order to avoid security loopholes. It would be too easy if this were possible to have a user submit information to other websites without them knowing.

Dirk.

It is indeed a javascript security restriction for the reason mentioned below. The best solution is to submit the request to your server and have the server fetch the page and process it (send it back as a response). And usually it’s a good idea to cache those offsite fetched responses.