Extjs + php. let's take a look at the question of my json output, or is my extjs not correct? Client: it mainly depends on the subm function on the sole. var & nbsp; main = new & nbsp; Ext. formPanel ({title: 'user registration', width: 500, extjs + php. let's take a look at the question of my json output, or is my extjs not correctly written?
Client: it mainly depends on the subm function on my sole,
Var main = new Ext. FormPanel ({
Title: 'user registration ',
Width: 500,
Frame: true,
BodyStyle: 'Margin: 10px ;',
RenderTo: 'tool ',
Height: 400,
Items :[
{
Layout: 'column ',
Border: false,
Items :[
{ColumnWidth:. 4,
Xtype: 'textfield ',
FieldLabel: 'name ',
LabelWidth: 30,
Regex:/^ [0-9a-zA-Z \.] + $ /,
RegexText: 'Only letters are allowed ',
RegexTextWidth: 300,
AllowBlank: false,
Name: 'name'
},{
ColumnWidth: 0.6,
Layout: 'column ',
BodyStyle: 'margin-left: 20px ',
Border: false,
Items :[
{
ColumnWidth:. 2,
Xtype: 'checkbox ',
Name: 'aihao ',
BoxLabel: 'soccer ',
},
{
ColumnWidth:. 2,
Xtype: 'checkbox ',
Name: 'aihao ',
BoxLabel: 'Soccer play'
}
]
}
]
}
],
Buttons :[
{Text: 'Save exist ',
Handler: subm },
{Text: 'Taobao '}
]
})
Function subm (){
If (! Main. isValid ()){
Return;
}
Main. getForm (). submit ({
WaitMsg: 'Data is being submitted ....',
Url: './php. php ',
Method: 'post ',
Params: main. getValues (),
Success: function (form, action ){
Alert ("OK ");
},
Failure: function (form, action ){
Alert ('');
}
})
}
Server:
$str=$_POST["name"];
$arr=array(
"name"=>"xiobai",
"sex"=>"28"
);
echo json_encode($arr);
?>
The problem is that he directly goes through failure: the function below, why not go to success: share:
------ Solution --------------------
You alert (form + action );
Instead of alert ('');