I have the following jquery code to call a webmethod in an aspx page
$.ajax({
type: "POST",
url: "popup.aspx/GetJewellerAssets",
contentType: "application/json; charset=utf-8",
data: '{"jewellerId":' + filter + '}',
dataType: "json",
success: AjaxSucceeded,
error: AjaxFailed
});
和 here is the web method signature
[WebMethod]
public static string GetJewellerAssets(int jewellerId)
{
This works fine.
但现在我需要将两个参数传递给web方法
新的Web方法如下所示
[WebMethod]
public static string GetJewellerAssets(int jewellerId, string locale)
{
}
How do I change the client code to successfully call this new method signature ?
EDIT:
以下两种语法有效
data: '{ "jewellerId":' + filter + ', "locale":"en" }',
和
data: JSON.stringify({ jewellerId: filter, locale: locale }),
where filter 和 locale are local variables