我有使用 JSON 响应的 WCF 服务。我想从我在 phonegap android 上的 javascript 从我的 WCF 服务中获取 JSON 字符串。但是当我从我的 javascript 调用 WCF 服务时,来自 WCF 服务的响应是空的。我已经测试调用这个 WCF 服务并且它可以工作。我的javascript错了吗?
这是我的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>
警报消息仅显示[object Object]
,当我尝试使用 firebug 跟踪它时,响应为空。
这是来自 WCF 服务的 JSON 字符串:
{"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"}]}