I first insert data into Mysql Database from the Form and later I want to show it automatically show it data into grid panel using ajax. How can I implement it? any help would be greatly appreciated.
ExtJS Coding:
{
xtype:'form',
border: 2,
bodyPadding: 10,
bodyCls: 'ux-noframe-bg',
width:300,
title:'Create API',
collapsible:true,
collapseDirection: 'right',
layout:'anchor',
fieldDefaults: {
labelWidth: 50,
anchor: '100%'
},
items: [{
//padding:10,
xtype: 'textfield',
itemId: 'keyNameField',
fieldLabel: 'Code',
labelClsExtra:'op5-spec-rsiveo-formapi-textfieldlabel',
name: 'thecode'
},{
xtype: 'button',
text: 'Create key',
margin: "20 10 0 10",
handler: function() {
var txt = this.down('#keyNameField') ;
var keyName = txt.getValue() ;
this.submitKeyName(keyName) ;
console.log(txt);
},
scope: this
}],
}]
}
PHP CODE :
function specRsiRecouveo_apikey_create($post_data){
global $_opDB ;
//print_r($post_data['_keyName']) ;
$data = array() ;
// automatic Date function
$datetime = new DateTime();
$localtime=$datetime->format('Y-m-d H:i');
//Auto generate Hexa Code 12 Digit
$hexacode = dechex(rand(0x00000000, 0xFFFFFFFFFFFF));
$query = "INSERT INTO view_file_Z_APIKEYS (field_APIKEY_CODE,field_APIKEY_DATE,field_APIKEY_HEX) VALUES ('{$post_data['_keyName']}','$localtime','$hexacode')" ;
//print_r($_opD;
$result = $_opDB->query($query) ;
return array('success'=>true, 'data'=>$data) ;
}
Database connect Backend:
case 'apikey_create':
return specRsiRecouveo_apikey_create( $post_data ) ;
Please help me to solve this issue and Thanks advanced for your help.