AJAX redirect, with absolute URL, corrupts the URL

I’m trying to redirect the browser to a URL outside of my domain on
some AJAX calls.
I do:

page.redirect_to(some_url)

It works fine with internal URLs, when I supply the :action
and :controller, but absolute URLs fail. Rails insists on applying
HTML encoding to the URL, thus replacing the & signs between arguments
to &

  • Same thing happens if I do the redirect from the .rjs template or
    from the controller.

Do I need to do something else to get this working?

Thanks,
Amir

Thanks Phlip,

That works great.

Amir

helzer wrote:

page.redirect_to(some_url)

It works fine with internal URLs, when I supply the :action
and :controller, but absolute URLs fail. Rails insists on applying
HTML encoding to the URL, thus replacing the & signs between arguments
to &

That might be an insect. Try more raw JavaScript:

page << “window.location.href = ‘#{my_uri}’;”


Phlip
http://www.oreilly.com/catalog/9780596510657/
“Test Driven Ajax (on Rails)”
assert_xpath, assert_javascript, & assert_ajax

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs