Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将Ajax get请求与用户身份验证结合使用?_Ajax - Fatal编程技术网

如何将Ajax get请求与用户身份验证结合使用?

如何将Ajax get请求与用户身份验证结合使用?,ajax,Ajax,如何使用带有MD-5哈希算法的用户身份验证的Ajax GET请求? 函数sendRequest(用户名、密码) { 变量url=”http://ajaxref.com/ch7/protectedhash.php"; var options={method:“GET”, 用户名:用户名, 密码:AjaxTCR.data.encodeMD5(密码), onSuccess:showResponse, onFail:showFail}; AjaxTCR.comm.sendRequest(url、选项)

如何使用带有MD-5哈希算法的用户身份验证的Ajax GET请求?


函数sendRequest(用户名、密码)
{
变量url=”http://ajaxref.com/ch7/protectedhash.php";
var options={method:“GET”,
用户名:用户名,
密码:AjaxTCR.data.encodeMD5(密码),
onSuccess:showResponse,
onFail:showFail};
AjaxTCR.comm.sendRequest(url、选项);
}
功能显示失败(响应、消息)
{
var responseOutput=document.getElementById(“responseOutput”);
responseOutput.innerHTML=“错误:”+消息;
}
函数showResponse(响应)
{
var responseOutput=document.getElementById(“responseOutput”);
responseOutput.innerHTML=response.xhr.responseText;
//document.location=”http://ajaxref.com/ch7/protectedhash/myprotectedpage.php";
}
window.onload=函数()
{ 
document.requestForm.requestButton.onclick=函数(){sendRequest(this.form.txtUser.value,this.form.txtPass.value);};
};

我投票结束这个问题,因为它根本没有表现出任何努力。