我正在尝试将Devise身份验证和jQuery Mobile用于Rails 3项目。 我已经将数据角色的东西添加到我的设计视图中,我可以做一些事情,比如注册新用户而没有任何问题。 事实上,只要我正确输入电子邮件和密码,我就可以毫无问题地登录。 如果我输错了,浏览器会抛出一个HTTP身份验证对话框。 我的config \ initializers \ devise.rb文件已经包含:
Devise.setup do |config| config.http_authenticatable = false config.http_authenticatable_on_xhr = false config.navigational_formats = [:html, :js] end我知道这与使用AJAX提交表单并返回401响应的jQuery Mobile有关,但我不知道我需要做什么才能让它像普通页面一样,只需用闪存重新渲染它信息。
我是AJAX和jQuery的新手,所以答案中的细节越多越好。
谢谢!
I'm trying to use Devise authentication and jQuery Mobile for a Rails 3 project. I've added the data-role stuff to my devise views and I can do things like register a new user without any problems. In fact, I can sign in without any problems as long as I correctly type the email and password. If I type something wrong the browser throws up an HTTP authentication dialog box. My config\initializers\devise.rb file already contains:
Devise.setup do |config| config.http_authenticatable = false config.http_authenticatable_on_xhr = false config.navigational_formats = [:html, :js] endI know this has something to do with jQuery Mobile using AJAX to submit the form and returning a 401 response, but I have no idea what I need to do to make it behave like a normal page where it just re-renders it with the flash message.
I'm totally new to AJAX and jQuery so the more details in an answer the better.
Thanks!
最满意答案
好吧,我想我终于搞清楚了。 我在我的application.mobile.erb文件中有j1移动CSS和JS文件的a1版本,我需要在我的iPhone上关闭浏览器以清除缓存。 无论如何,我认为这就解决了这个问题。 现在似乎工作正常。
Well, I think I finally figured this out. I had the a1 versions of jQuery Mobile CSS and JS files in my application.mobile.erb file AND I needed to shut down my browser on my iPhone to clear the cache. Anyway, I think that is what resolved the problem. It seems to be working fine now.
更多推荐
发布评论