In firebug, in the POST tab i see the following;
JSON
textfieldone "Alex"
Source
{"textfieldone :"Alex"}
But in the PARAMS tab i see
_dc 1341332451114
In my PHP code when i print_r($_REQUEST); i get
Array
(
[_dc] => 1341332451114
)
and not the JSON, that was found in the POST tab. How could i solve this ?
I have no clue why this is hapenning, i have tried to debug this all day
UPDATE PHP CODE:
<?php
// Make a MySQL Connection
mysql_connect("localhost", "root", "pwd") or die(mysql_error());
mysql_select_db("db") or die(mysql_error());
print_r($_REQUEST);
In firebug i see the above Responces under the url;
POST http://localhost/proj/php/result.php?_dc=1341332451114 200 OK 107ms
May i know what ?_dc=1341366375982 is. I am sending POST
UPDATE 2
EXT JS4 code
MODEL
Ext.define ('Mycomp.model.MyClass',{
extend: 'Ext.data.Model',
fields:['textfieldone']
});
VIEW
Ext.define('Mycomp.view.user.MyClassView', {
extend: 'Ext.window.Window',
alias: 'widget.myclassview',
initComponent: function() {
this.items = [
{
xtype: 'form',
items: [
{
xtype: 'textfield',
name : 'textfieldone',
fieldLabel: 'Contact Person Name'
}
]
}
];
this.buttons = [
{
text: 'Save',
name:'save',
action: 'save'
}
];
this.callParent(arguments);
}
});
CONTROLLER
Ext.define('Mycomp.controller.MyClass',{
extend: 'Ext.app.Controller',
stores:['MyClass'],
models:['MyClass'],
views:['MyClassView'],
init: function(){
this.control({
'myclassview button[action=save]': {
click: this.myMethod
}
});
},
myMethod: function(button, record) {
var win = button.up('window'),
form = win.down('form'),
values = form.getValues(),
store = this.this.getmyClassStore(),
model = store.model,
record = model.create();
record.set( values );
store.add( record );
win.close();
store.sync();
}
});
STORE
Ext.define('Mycomp.store.Myclass',{
extend:'Ext.data.Store',
model:'App.model.Myclass',
proxy: {
actionMethods : {
create : 'POST'
},
type: 'ajax',
url : '/savetodb.php'
}
});
I think you’ll want to set your .php file headers to serve up JSON: