繁体   English   中英

通过摘要身份验证,jquery ajax调用使用RestFul PHP Web服务

[英]Consume RestFul PHP webservice with digest auth, jquery ajax call

我想知道如何使用摘要身份验证来调用RestFul PHP Web服务?

创建基本请求时,服务器需要身份验证,但我不知道如何发送用户名和密码。 我需要这个用于phonegap应用程序。

$.ajax({
    type: "GET",
    url: "http://webservice",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (msg) {
        alert(msg);
    }

});

谢谢,

调用$.ajax时使用data参数

$.ajax({
    type: "GET",
    url: "http://webservice",
    data: {username:'Your Username', password:'Your Password'},
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (msg) {
        alert(msg);
    }
});

暂无
暂无

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

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