首页 \ 问答 \ 应用程序中的服务器localhost:3000需要用户名和密码(The server localhost:3000 at Application requires a username and password)

应用程序中的服务器localhost:3000需要用户名和密码(The server localhost:3000 at Application requires a username and password)

我正在Ubuntu 11.04上开发一个Rails 3应用程序,当我尝试执行ajax post请求时,我得到以下浏览器对话框。

应用程序中的服务器localhost:3000需要用户名和密码

所有其他页面加载正常。 它只是在执行ajax调用时发生。 我正在使用Mongrel作为rails开发服务器。

有关如何解决此问题的任何想法,以便不会出现对话框?


I'm developing a Rails 3 app on Ubuntu 11.04, and I get the following browser dialog box when I try to perform an ajax post request.

The server localhost:3000 at Application requires a username and password

All the other pages load fine. It just happens when an ajax call is performed. I'm using Mongrel for the rails development server.

Any ideas on how to solve this issue so the dialog box won't appear?


原文:https://stackoverflow.com/questions/6083981
更新时间:2023-04-15 21:04

最满意答案

我发现你可以show | hide 使用$.mobile.loading()函数show | hide 加载器 ,这样:

以显示:

$.mobile.loading( 'show', {
    text: 'Verificando Datos',
    textVisible: true,
    theme: 'z',
    html: ""
});

隐藏:

$.mobile.loading('hide');

至于为什么要渲染加载器,我所做的是使用jQuery CDN,但我只使用脚本而不是CSS引用,所以当时发生的是“加载”显示在页面底部,如我添加CSS引用后,这个加载器就消失了。 仅在一个页面中 (这发生在我的两个页面中) 。 我不想包含CSS引用的原因是因为设计被覆盖而我不想要这个。

另一页的问题,我只通过添加一些CSS来解决它: .ui-loader{display: none}

希望有人可以添加这个答案,但目前我认为它解决了我的问题。


I found that you can show | hide the loader using the $.mobile.loading() function so:

To show:

$.mobile.loading( 'show', {
    text: 'Verificando Datos',
    textVisible: true,
    theme: 'z',
    html: ""
});

To hide:

$.mobile.loading('hide');

As to why the loader is being rendered, what I did was to use jQuery CDN but I only used the script and not the CSS reference, so what then happened was that the "loading" was being displayed at the bottom of the page, as soon as I added the CSS reference this loader went away. In one page only (this was happening in two of my pages). The reason I didn't want to include the CSS reference was because the design was being overriden and I didn't want this.

The other page's problem, I solved it by ONLY adding some CSS: .ui-loader{display: none}

Hopefully someone can add to this answer, but for the moment I believe it solves my issues.

相关问答

更多
  • 我今天遇到了这个问题,当我即将发布同样的问题时,当我输入我的帖子标题时,我遇到了这个帖子 。 这反过来又引导我进入jquery文档 。 基本上我所做的是剥离模板中的空格,它工作正常。 IE: 之前: 后: