c# - Jquery $.ajax, msg is empty when I call a web service (WCF) method -
i have web service wcf , call methods of wcf jquery ajax.
when tested method without parameter, works well.
but when call method parameter, doesn't work.
the problem in success in $.ajax, msg empty.
here javascript code :
function getstatistic3() { var response; var allstat3 = []; var allyearstat3 = []; var kla = $('#select1').val(); kla = kla.replace("'", "\\'"); if (kla) { $.ajax({ type: 'get', url: 'http://localhost:52768/service1/statistic_3', data: "klant='" + encodeuricomponent(kla) + "'", contenttype: 'application/json; charset=utf-8', datatype: 'json', success: function (msg) { response = msg; (var = 0; < response.items.length; i++) { var j = 0; allstat3[i] = [response.items[i].interventie, response.items[i].sum[j], response.items[i].sum[++j], response.items[i].sum[++j], response.items[i].sum[++j], response.items[i].sum[++j]]; } allyearstat3[0] = [response.items[0].yearstart, response.items[0].yearstart + 1, response.items[0].yearstart + 2, response.items[0].yearstart + 3, response.items[0].yearstart + 4]; filldatatable3(allstat3, allyearstat3); if (bool3) { $('thead tr th:eq(0)').replacewith(function () { return $("<td />").append($(this).contents()); }); $('thead th').attr('scope', 'col'); bool3 = false; } $('table').visualize({ type: 'line' }); }, error: function (e) { alert("error loading statistic 3"); } }); } }
i tested .asmx web service , works well.
i have error when call method :
typeerror: response.items[0] undefined
msg empty :
i think have problem when pass parameter in ma $.ajax.
Comments
Post a Comment