json - Why response from my WCF Service is empty when I call it from javascript on phonegap android? -


i've wcf service response json. want json string wcf service javascript on phonegap android. when call wcf service javascript, response wcf service empty. i've test call wcf service , works. javascript wrong?

here javascript:

<script type="text/javascript">         function displaytext()         {             $.ajax(                     {                         type: "get",                         contenttype: "application/json; charset=utf-8",                         url: "http://10.80.3.73/webservice/service1.svc/json/weeklyflash/id",                         datatype: "json",                         success:function(data){                             alert(data);                         },                         error: function () {                              alert("error");                          }                     });          }    </script> 

the alert message shows [object object] , when try track firebug response empty.

here json string wcf service:

{"getreportidresult":[{"bulan":"4","total":"1728","type":"cheese1k","uang":"8796383"},{"bulan":"4","total":"572476","type":"esl","uang":"5863408410"},{"bulan":"4","total":"46008","type":"esl500ml","uang":"234498301"},{"bulan":"4","total":"190369","type":"uht","uang":"1367063805"},{"bulan":"4","total":"33507","type":"whp","uang":"235653242"},{"bulan":"5","total":"4761","type":"cheese1k","uang":"134877865"},{"bulan":"5","total":"648663","type":"esl","uang":"6645764498"},{"bulan":"5","total":"49305","type":"esl500ml","uang":"266817346"},{"bulan":"5","total":"245867","type":"uht","uang":"1446787280"},{"bulan":"5","total":"47974","type":"whp","uang":"631929807"},{"bulan":"6","total":"5762","type":"cheese1k","uang":"293393832"},{"bulan":"6","total":"594942","type":"esl","uang":"6088671790"},{"bulan":"6","total":"39457","type":"esl500ml","uang":"221983181"},{"bulan":"6","total":"236803","type":"uht","uang":"2219506085"},{"bulan":"6","total":"24853","type":"whp","uang":"386175022"}]} 

when use jquery , specify datatype: 'json', jquery de-serializes json string javascript object @ runtime before invoking success callback.

the reason see [object object] : string representation of javascript object.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -