function getMainContent(ID, num, lang){
$.ajax({
type: "POST",
url: "WebMethods.aspx/showMain",
data: '{AID: "' + articleID+ '", ANum: "' +num + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: showSuccess,
failure: function(response) {
alert(response);
}
});
Run Code Online (Sandbox Code Playgroud)
lang在我的页面上可以作为Session ["Lang"].如何访问并将其发送到Web方法?
您可以直接访问页面方法内的会话:
[WebMethod(EnableSession = true)]
public static string ShowMain()
{
var lang = HttpContext.Current.Session["Lang"];
return "foo";
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4808 次 |
| 最近记录: |