Forum: Ruby on Rails Simpleton routes

Posted by Joshua Niehus (Guest)
on 2012-09-16 11:04
(Received via mailing list)
Is there some way to keep rails from trying to open a page on a route?
Basically I just want to send an ajax query to:
http://localhost:3000/method/multiply?num1=3&num2=4

while staying on http://localhost:3000/index

Thanks Josh
Posted by Hassan Schroeder (Guest)
on 2012-09-16 14:53
(Received via mailing list)
On Sat, Sep 15, 2012 at 8:57 PM, Joshua Niehus <jm.niehus@gmail.com> 
wrote:
> Is there some way to keep rails from trying to open a page on a route?
> Basically I just want to send an ajax query to:
> http://localhost:3000/method/multiply?num1=3&num2=4
>
> while staying on http://localhost:3000/index

See:  http://guides.rubyonrails.org/layouts_and_rendering.html

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Posted by Joshua Niehus (Guest)
on 2012-09-17 05:56
(Received via mailing list)
None of those seem to help, Rails just goes to some blank page with 
either:
a) render :nothing => true
b) head (blah blah...)

I have an ajax request for the server to check something for me but i do
not want to be redirected anywhere when I call it...
not to a blank page or some generated template page, I just want the 
text
response
Posted by Hassan Schroeder (Guest)
on 2012-09-17 07:26
(Received via mailing list)
On Sun, Sep 16, 2012 at 8:55 PM, Joshua Niehus <jm.niehus@gmail.com> 
wrote:
> None of those seem to help, Rails just goes to some blank page

Actually, your app goes to some blank page. The guide I linked to
earlier explains how to control that :-)

If that's not enough, post your request code and the corresponding
method from your controller.

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Posted by Joshua Niehus (Guest)
on 2012-09-17 17:53
(Received via mailing list)
Indeed, you are right! I saw what I was doing wrong.

Thank you,
Josh
"In your wisdom, I am humbled"
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.