KendoUI和json [英] KendoUI and json

查看:153
本文介绍了KendoUI和json的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对kendoUI和json很新,我的问题是,似乎数据没有加载,可能是错误的架构或其他东西,没有错误,只是组合框加载整个时间。
这是我的示例代码:

I'm quite new to kendoUI and json, my problem is that It's seems the data does not load, maybe incorrect schema or something, get no errors, just the combobox loading the whole time. Here's my sample code:

$(document).ready(function () {
    clientDS = new kendo.data.DataSource({
        transport: {
            read: {
                url: "http://localhost/JSON_MP.asmx/GetListCountries?developerId=101&developerHash=9df7273b410761f74331bde746e5c2354b73b487&timestamp=1242207092430",  //Note the URL path!
                dataType: "json",
                contentType: "application/json; charset=utf-8"

            }
        },
        schema: {
            data: "listValues"               
        }
    });

    $("#kendoCboClient").kendoComboBox({
        placeholder: "Select a Country...",
        dataTextField: "name",
        dataValueField: "id",
        dataSource: clientDS
    });
});

和我的数据堆栈:

{errorString:ok,errorCode:0,listValues:[{name:UNKNOWN,id:1},{name:南非,id: 2},{ 名称: 莫桑比克, ID:3},{ 名称: 菲, ID:4},{ 名称: 纳米比亚, 标识:5} ,{name:United Arab Emirates,id:6},{name:England,id:7},{name:Swaziland,id:8} { 名: 葡萄牙, ID:9},{ 名: 希腊, ID:10},{ 名: 毛里求斯, ID:11},{ 名称: 坦桑尼亚, 标识:12},{ 名称: 波扎那, ID:13},{ 名称: 西班牙, ID:15},{名:Scottland,id:16},{name:Australia,id:17},{name:New Zealand,id:18},{name :Cyprus,id:19},{name:United States,id:20},{name:Germany,id:21},{name: , 标识:22},{ 名称: 马达加斯加, ID:23},{ 名称: 马来西亚, 标识:24},{ 名称: 塞舌耳 ,id:25}],listType:国家}

{"errorString":"ok","errorCode":0,"listValues":[{"name":"UNKNOWN","id":1},{"name":"South Africa","id":2},{"name":"Mozambique","id":3},{"name":"Philippines","id":4},{"name":"Namibia","id":5},{"name":"United Arab Emirates","id":6},{"name":"England","id":7},{"name":"Swaziland","id":8},{"name":"Portugal","id":9},{"name":"Greece","id":10},{"name":"Mauritius","id":11},{"name":"TANZANIA","id":12},{"name":"Botswana","id":13},{"name":"Spain","id":15},{"name":"Scottland","id":16},{"name":"Australia","id":17},{"name":"New Zealand","id":18},{"name":"Cyprus","id":19},{"name":"United States","id":20},{"name":"Germany","id":21},{"name":"","id":22},{"name":"Madagascar","id":23},{"name":"Malaysia","id":24},{"name":"Seychelles","id":25}],"listType":"Country"}

如果有人可以指出我正确的方向或某事,请注意数据-stack我正在使用listValues对象,可能是因为呃 rorString:ok,errorCode:0,部分问题是什么?

If someone can just point me into the right direction or something, note that in the data-stack I'm using "listValues" objects, can be maybe because the ""errorString":"ok","errorCode":0," part that is the issue?

推荐答案

我有类似的问题 - 没有数据也没有错误。实际问题是返回json数据的页面是发送html内容类型标题而不是application / json。此问题实际上已在此处解决: http:// docs.kendoui.c​​om/tutorials/PHP/build-apps-with-kendo-ui-and-php (向下滚动到没有数据......部分)并通过确保您正在发送正确的内容类型标题。

I had a similar issue - no data and no error. The actual problem was that the page returning the json data was sending "html" content type header instead of the "application/json". This issue is actually addressed here: http://docs.kendoui.com/tutorials/PHP/build-apps-with-kendo-ui-and-php (scroll half-way down to the section "There’s No Data…") and is fixed by making sure that you are sending the correct content type header.

这篇关于KendoUI和json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆