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);
}
})
}
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);
}
})
}