質問

私はjQueryを使ってASP.NETページの方法を使用しています。ここに私のコードは、

$.ajax({
      type: "POST",
      url: "Default.aspx/GetRecords",
      data: "{}",
      contentType: "application/json; charset=utf-8",
      dataType: "json",

とASP.NETページの方法がある、

[WebMethod]
public static string GetRecords(int currentPage,int pagesize)
{
    // my logic here
}

jQueryのからcurrentPagepagesizeの値を渡すには?

役に立ちましたか?

解決

私はそれが働いて得ました。マイデータセクションがなければなりません。

data: "{'currentPage':1,'pagesize':5}",

他のヒント

あなただけしようとしました。

$.ajax({
    type: "POST",
    url: "Default.aspx/GetRecords",
    data: {"currentPage": 1, "pageSize": 100},
    contentType: "application/json; charset=utf-8",
    dataType: "json",

これを試してみてください
$.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        data: "{ currentPage: '" +parseInt( $('#currentpage').val()) + "',pageSize:'"+parseInt( $('#pagesize').val()) +"'}",
        url: "Default.aspx/GetRecords",
        dataType: "json",
        success: function (data) {
                     $("#result").html(data.d);
                 }
        });
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top