如何与jquery进行HTTP身份验证来验证登录系统? [英] how to communicate HTTP authentication with jquery to authenticate login system?
问题描述
我正在尝试启动HTTP身份验证框来处理我的登录信息。但是,我想通过Ajax与我的数据库进行通信。但我不知道如何将HTTP身份验证框与AJAX连接。
I am trying to bring up the HTTP authentication box for handling my login. However, I want to communicate to my database through Ajax. But I dont know how to connect the HTTP authentication box with AJAX.
任何想法,如何做到这一点?还请包括示例
Any Idea, how to do this? Please also include example
推荐答案
(令我惊讶的是)jQuery内置了支持提供HTTP认证凭证:
(To my surprise) jQuery has built-in support for supplying HTTP auth credentials:
$.ajax({
url: "http://example.org/",
username: "NAMENAMENAMENAMENAME",
password: "PWPWPWPWPWPWPWPWPWPW",
...
})
或者您可以重写XMLHttpRequest对象,如下例所示: http://dothow.blogspot.com/2009/ 05 / http-basic-authentication-with-jquery.html
Or you can override the XMLHttpRequest object like in this example: http://dothow.blogspot.com/2009/05/http-basic-authentication-with-jquery.html
这篇关于如何与jquery进行HTTP身份验证来验证登录系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!