“你正在尝试解码一个无效的JSON字符串”但它是一个PHP

Good day,

I'm pretty new in extjs 5 and mvvm. I want to make an ajax request in order to display a treepanel with datas caught with a php.

Here is my store

Ext.define('MyApp.store.servicesStore', {
    extend: 'Ext.data.TreeStore',
    // alias: 'store.servicesStore',
    storeId : 'servicesStore',
    model   : 'MyApp.model.servicesModel',
    proxy: {
        type: 'ajax',
        url: 'app/store/data/GetServices.php'
    },
    root: {
        text: 'Events',
        id: 'root'
    },
    autoLoad: true,
    folderSort: true
});

I've seen that a "success" can resolve that issue but I don't need a succes as it's only displayed in a treePanel

Ext.define('MyApp.view.tabServices.servicesTab', {    
    extend: 'Ext.tree.Panel',
    xtype: 'servicesTab',
    layout: {
        type: 'border'
    },
    useArrows: true,
    rootVisible: false,
     store: {type: 'servicesStore'},
    forceFit: true,
    columns: [{
        xtype: 'treecolumn',
        dataIndex: 'text',
        width: 600
    }, {
        dataIndex: 'mbt',
        cls: 'mbtcss',
        width: 80
    }, {
        dataIndex: 'bt',
        cls: 'btcss',
        width: 75
    }, {
        dataIndex: 'details', // port separated from rest
        width: 60
    }, {
        dataIndex: 'code',
        width: 80
    }]
});

So, when I launch my app, the "You're trying to decode an invalid JSON String" appears, how can I do to make it understand that I actually use a php file? More precisely, that code is working in extjs 3.4

查看全部
douping3860
douping3860
2014/09/01 14:17
  • mvvm
  • php
  • ajax
  • extjs
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复