(2) Kendo UI Remote Data Organization server and client

Source: Internet
Author: User
<SCRIPT> var sharabledatasource = new Kendo. data. datasource ({transport: {read: {URL: "data-service.json", datatype: "JSON" }}, Schema: {data: function (d) {return D. data; // response to the page data}, total: function (d) {return D. count; // Total number of items }}); var datasource = new Kendo. data. datasource ({transport: {read: {URL: "http://t.sogx.cn/api/data/getQzxx.php", datatype: "jsonp", data: {q: "HTML5" }}, SC Hema: {data: function (d) {return D. data; // response to the page data}, total: function (d) {return D. count; // total number of entries }}); var viewmodel = Kendo. observable ({products = datasource;}); Kendo. BIND ($ ("Div"), viewmodel ); </SCRIPT> ============================== binding jquery to Kendo to remotely obtain data ========== =================$ (document ). ready (function () {$. ajax ({type: 'get', async: false, URL: "http://t.sogx.cn/wap/index.php? M = user & C = show & id = 2 ", data:" ajax = 1 ", datatype:" jsonp ", success: function (OBJ) {var viewmode5222 = Kendo. observable ({data2: obj. data}); Kendo. BIND ($ ("# drawer-resume"), viewmode5222 );}})}); ====================================<? Phpheader ('content-type: text/html; charset = gb2312 '); header ("access-control-allow-origin :*"); header ("access-control-allow-headers: X-requested-with"); Include ("D:/www.qmlt.com/global.php"); require (model_path. 'class/Common. PHP '); $ db-> query ("set Character Set 'gb2312'"); $ db-> query ("set names 'gb2312 '"); $ q = $ _ Get ['q']; if ($ q = "") {$ SQL = "select ID, name from qm_industry ";} else {$ SQL = "select ID, name from qm_jo B _class where keyid = '$ Q' ";}$ Ku = $ db-> query ($ SQL); $ result = array (); $ I = 0; while ($ rs = $ db-> fetch_array ($ ku) {$ result ['data'] [$ I] ['id'] = $ Rs [ID]; $ result ['data'] [$ I] ['name'] = (TRIM (U ($ Rs [name])! = "")? U ($ Rs [name]): "(untitled)"; $ I ++;} $ result ['Count'] = $ I; echo $ _ Get ['callback']. "(". json_encode ($ result ). ")";?>
When binding 1. kendoui template data #, you must find the data source format (one-dimensional or multi-dimensional. If the preceding conditions are not met, the binding fails, and a blank error is displayed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.