Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想为我的管理页面提示本地登录(类似于http://demo2.opencrypt.com/oc/members/)。
我知道大多数情况下我必须使用 $.ajax 并强制它响应 statusCode 401。但是,我不知道应该如何进行。
提前致谢!
我不确定,但我认为如果您想处理基本身份验证,您不能让用户自己显示该表单。这直接来自网络服务器,但是如果您只需要对该 ajax 请求进行身份验证,您可以尝试使用此模式:
http://user:password@server/path/to/file
虽然您需要自己处理该用户名和密码。