gpt4 book ai didi

jquery - 无效的 Web 服务调用,缺少参数值

转载 作者:行者123 更新时间:2023-12-01 00:11:45 25 4
gpt4 key购买 nike

我看了这个问题有一段时间了,不知道问题出在哪里。非常感谢任何帮助。

[WebMethod(true)]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public static string neighbourhoodTeam(string force, string neighbourhood)
{
//StreamManager streamMan = new StreamManager();
//return streamMan.StreamManagerUrlHandler("http://policeapi2.rkh.co.uk/api/" + force + "%2F" + neighbourhood + "%2F" + "people");
return neighbourhood + force;
}

jQuery:

function getOfficers(force, neighbourhood) {
$.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
url: "../police/crimerequest.aspx/neighbourhoodTeam",
data: JSON.stringify({ "force": force, "neighbourhood": neighbourhood }),
dataType: "json",
success: function (data) {
var results = $.parseJSON(data.d);
$.each(results, function (i) {
businessCards.push(generateOfficerBusinessCard(
results[i].name,
results[i].rank,
results[i].contact_details.mobile,
results[i].contact_details.tel,
results[i].contact_details.email))
});
PoliceApp.businessCardsPlaceHolder.html(businessCards.toString());
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
alert(xhr.responseText);
return false;
}
});
}

我得到:{"Message":"无效的 Web 服务调用,缺少参数值:\u0027force\u0027。","StackTrace":"

最佳答案

尝试在ajax参数中使用processData: false发送。默认情况下,jQuery 将再次进行字符串化。

使用 fiddler 或类似工具检查网络流量并查看实际发送到您的网络服务的内容。

关于jquery - 无效的 Web 服务调用,缺少参数值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6471759/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com