weixin_33701251 2014-11-19 00:16 采纳率: 0%
浏览 19

jQuery参数长度错误

How much data length in jQuery ? I did not add it to the database. How do I add it to the database ??

function bulten_kayit_ajax(ligId, ligName, ligGroupId, regionName, takimId, tarih, saat, kod, mbs, karsilasma, oranSayisi, live, macSonucu, cifteSans, karsilikliGol, ilkYari_ikinciYari, handikap_10, altUst_MS, TG_İY, TG_2Y, tekCift_MS, tekCift_İY, skor_MS, skor_İY, herhangi1Takim_1fark, herhangi1Takim_2fark, herhangi1Takim_3fark, iy_KG, iy, iy_CifteSans, iy_ms_dahaCokGol, takim1_toplam_KG_MS, takim1_toplam_KG_İY, takim1_toplam_KG_2Y, takim2_toplam_KG_MS, takim2_toplam_KG_İY, takim2_toplam_KG_2Y)
    {
        var data = "{ligId:'" + ligId + "',ligName:'" + ligName + "',ligGroupId:'" + ligGroupId + "',regionName:'" + regionName + "',takimId:'" + takimId + "',tarih:'" + tarih + "',saat:'" + saat + "',kod:'" + kod + "',mbs:'" + mbs + "',karsilasma:'" + karsilasma + "',oranSayisi:'" + oranSayisi + "',live:'" + live + "',macSonucu:'" + macSonucu + "',cifteSans:'" + cifteSans + "',karsilikliGol:'" + karsilikliGol + "',ilkYari_ikinciYari:'" + ilkYari_ikinciYari + "',handikap_10:'" + handikap_10 + "',altUst_MS:'" + altUst_MS + "',TG_İY:'" + TG_İY + "',TG_2Y:'" + TG_2Y + "',tekCift_MS:'" + tekCift_MS + "',tekCift_İY:'" + tekCift_İY + "',skor_MS:'" + skor_MS + "',skor_İY:'" + skor_İY + "',herhangi1Takim_1fark:'" + herhangi1Takim_1fark + "',herhangi1Takim_2fark:'" + herhangi1Takim_2fark + "',herhangi1Takim_3fark:'" + herhangi1Takim_3fark + "',iy_KG:'" + iy_KG + "',iy:'" + iy + "',iy_CifteSans:'" + iy_CifteSans + "',iy_ms_dahaCokGol:'" + iy_ms_dahaCokGol + "',takim1_toplam_KG_MS:'" + takim1_toplam_KG_MS + "',takim1_toplam_KG_İY:'" + takim1_toplam_KG_İY + "',takim1_toplam_KG_2Y:'" + takim1_toplam_KG_2Y + "',takim2_toplam_KG_MS:'" + takim2_toplam_KG_MS + "',takim2_toplam_KG_İY:'" + takim2_toplam_KG_İY + "',takim2_toplam_KG_2Y:'" + takim2_toplam_KG_2Y + "'}";
        alert(JSON.stringify(data));
        $.ajax
            ({
                type: "POST",
                url: "bwin_bultenaspx.aspx/bulten_kayit",
                data:data,
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (msg)
                {
                    alert(msg.d);
                },
                error: function (xhr, status, error) {

                    errorHandling(xhr, status, error);
                }
            })
    }
  • 写回答

1条回答 默认 最新

  • weixin_33681778 2014-11-19 00:27
    关注

    You can pass a plain object to jQuery.ajax() and it will convert it correctly into a JSON string for you. So instead of trying to manually construct a valid JSON string yourself, which is tricky and easy to make mistakes with, try constructing an object and then let jQuery convert it to JSON for you.

    Change your function to:

    function bulten_kayit_ajax(ligId, ligName, ligGroupId, regionName, takimId, tarih, saat, kod, mbs, karsilasma, oranSayisi, live, macSonucu, cifteSans, karsilikliGol, ilkYari_ikinciYari, handikap_10, altUst_MS, TG_İY, TG_2Y, tekCift_MS, tekCift_İY, skor_MS, skor_İY, herhangi1Takim_1fark, herhangi1Takim_2fark, herhangi1Takim_3fark, iy_KG, iy, iy_CifteSans, iy_ms_dahaCokGol, takim1_toplam_KG_MS, takim1_toplam_KG_İY, takim1_toplam_KG_2Y, takim2_toplam_KG_MS, takim2_toplam_KG_İY, takim2_toplam_KG_2Y) {
        var data = {
            ligId: ligId,
            ligName: ligName,
            ligGroupId: ligGroupId,
            regionName: regionName,
            takimId: takimId,
            tarih: tarih,
            saat: saat,
            kod: kod,
            mbs: mbs,
            karsilasma: karsilasma,
            oranSayisi: oranSayisi,
            live: live,
            macSonucu: macSonucu,
            cifteSans: cifteSans,
            karsilikliGol: karsilikliGol,
            ilkYari_ikinciYari: ilkYari_ikinciYari,
            handikap_10: handikap_10,
            altUst_MS: altUst_MS,
            TG_İY: TG_İY,
            TG_2Y: TG_2Y,
            tekCift_MS: tekCift_MS,
            tekCift_İY: tekCift_İY,
            skor_MS: skor_MS,
            skor_İY: skor_İY,
            herhangi1Takim_1fark: herhangi1Takim_1fark,
            herhangi1Takim_2fark: herhangi1Takim_2fark,
            herhangi1Takim_3fark: herhangi1Takim_3fark,
            iy_KG: iy_KG,
            iy: iy,
            iy_CifteSans: iy_CifteSans,
            iy_ms_dahaCokGol: iy_ms_dahaCokGol,
            takim1_toplam_KG_MS: takim1_toplam_KG_MS,
            takim1_toplam_KG_İY: takim1_toplam_KG_İY,
            takim1_toplam_KG_2Y: takim1_toplam_KG_2Y,
            takim2_toplam_KG_MS: takim2_toplam_KG_MS,
            takim2_toplam_KG_İY: takim2_toplam_KG_İY,
            takim2_toplam_KG_2Y: takim2_toplam_KG_2Y
        };
        alert(JSON.stringify(data));
        $.ajax({
            type: "POST",
            url: "bwin_bultenaspx.aspx/bulten_kayit",
            data: data,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (msg) {
                alert(msg.d);
            },
            error: function (xhr, status, error) {
    
                errorHandling(xhr, status, error);
            }
        })
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 求chat4.0解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果