我想知道如何使用摘要身份验证调用RestFul PHP Web服务?
当我创建基本请求时,服务器需要auth,但我不知道如何发送用户名和密码。我需要这个用于phonegap app。
$.ajax({
type: "GET",
url: "http://webservice",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
alert(msg);
}
});
谢谢,
答案 0 :(得分:0)
在致电data
$.ajax
参数
$.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);
}
});