Code:
Ext.require([
    'Ext.form.*',
    'Ext.data.*'
]);


Ext.onReady(function(){


    Ext.define('customer', {
		extend: 'Ext.data.Model',
		fields: [
			{type: 'int', name: 'id'},
			{type: 'string', name: 'company'},
			{type: 'string', name: 'vat'},
			{type: 'string', name: 'ssn'},
			{type: 'int', name: 'ref_id'}
		]
	});
	
	var required = '<span style="color:red;font-weight:bold" data-qtip="Required">*</span>';
	
	/*var customer_store = Ext.create('Ext.data.Store', {
							autoDestroy: true,
							model: 'customer',
							autoLoad: true,
							proxy: {
								type: 'ajax',
								url: 'load.php?item=customer',            
								reader: {
									type: 'json',
									successProperty: 'success',
									root: 'data'
								}
							}
					    });*/


    var formPanel = Ext.create('Ext.form.Panel', {
        renderTo: 'form-ct',
        frame: true,
        title:'Edit customer',
        width: 340,
        bodyPadding: 5,
        waitMsgTarget: true,


        fieldDefaults: {
            labelAlign: 'right',
            labelWidth: 85,
            msgTarget: 'side'
        },


        reader : Ext.create('Ext.data.reader.Json', {
            model: 'customer',
            successProperty: 'success',
			root: 'data'
        }),
		items: [{
			fieldLabel: 'company',
			name: 'company'
			allowBlank:false,
			afterLabelTextTpl: required
		},{
			fieldLabel: 'vat', //I.V.A.
			name: 'vat'
			allowBlank:false,
			afterLabelTextTpl: required
		},{
			fieldLabel: 'ssn', //fiscal code
			name: 'ssn'
			allowBlank:false,
			afterLabelTextTpl: required
		}/*,{
			xtype: 'combobox',
			fieldLabel: 'reference customer',
			name: 'ref_id',
			store:  customer_store,
			valueField: 'id',		
			displayField: 'company',
			typeAhead: true,
			queryMode: 'remote',
			emptyText: 'Select a customer'
		}*/],


        buttons: [{
            text: 'Load selected customer',
            handler: function(){
                formPanel.getForm().load({
                    url: <?php echo "'load_customer.php?id=".$_GET['id']."',"; ?>
                    waitMsg: 'Loading...'
                });
            }
        }/*, {
            text: 'Submit',
            disabled: true,
            formBind: true,
            handler: function(){
                this.up('form').getForm().submit({
                    url: 'xml-form-errors.xml',
                    submitEmptyText: false,
                    waitMsg: 'Saving Data...'
                });
            }
        }*/]
    });


});
Hello everyone,
I have a problem with code written above, because it doesn't work as I'd like.
That code is inspired by the example called 'Ajax with XML forms' (http://dev.sencha.com/deploy/ext-4.1.../xml-form.html), when the user hits the 'Load selected customer' button a PHP script fetches a record from a MySQL database, encodes fetched data as a JSON string and then sends that string to output stream by using 'echo' instruction.
The code doesn't work as expected, because when I run it the only result I obtain is an empty form, that is a form without any fields.
I have done some debug and I'm sure that 'load_customer.php' works fine: it returns the JSON string I expect.
Any idea to fix my code ?
Thanks in advance.