Without remote: true in my form, the login works. But, when using remote: true, and attempting to login via ajax, I receive this error:
You need to sign in or sign up before continuing.
The requests are both post. Can somebody enlighten me?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are some steps that you need to follow:
1) Check whether the request made is of javascript.
To verify that you should check the request header to see what the Accept parameter is. If it says
application/javascriptthen it’s all good. Use tools like firebug to check the request headers easily.2) What javascript files are included?
Secondly, a very common problem when starting to try out the
:remote => trueis that the required javascript libraries are not included in your code. So my guess is that the following code is missing from your layout:If that is the case, just include it inside the html header.
3) Check the controller: does it have a respond_to block?
If you generated your app with
rails generate scaffold, it will have something likeReplace the above code with:
OR
4) Setup CSRF Token in your application.js
5) Post your login information