繁体   English   中英

如何在不刷新整个页面的情况下从 javascript 为用户提供浏览器的本机身份验证对话框?

[英]How to give user the browser's native auth dialog from javascript without refreshing the whole page?

我真的很喜欢浏览器的本机身份验证对话框。 Not something written in html form, but the dialog the browser shows for "WWW-Authenticate: Digest" header etc. Now I want to give user this dialog when a user clicks a certain html button, and handle the response from server in a javascript回调而不刷新整个页面。 可能吗?

是的,可以在不刷新整个 HTML 页面的情况下显示某些内容。 该技术称为AJAX (异步 JavaScript 和 XML)。 这是一个 JavaScript 技术,它允许我们将数据发送到服务器并从服务器获取结果,而无需刷新整个 HTML 页面。

https://www.w3schools.com/jquery/jquery_ajax_intro.asp
https://www.w3schools.com/jquery/jquery_ajax_load.asp
https://www.w3schools.com/jquery/jquery_ajax_get_post.asp

上面三个链接描述了 AJAX 技术。

第二种技术是.load(),它将 html 数据加载到选定的容器(div、选择器等)中。您可以加载 AJAX,当用户单击按钮时会显示对话框。

我希望你能从我的回答中得到一些帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM