extjs+php, everyone to see is my JSON output problem, or my extjs didn't write right?
Client: Mainly look at my sole SUBM this function has no problem,
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: ' Can only be letters ',
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: ' Football ',
},
{
Columnwidth:.2,
Xtype: ' checkbox ',
Name: ' Aihao ',
Boxlabel: ' Playing football '
}
]
}
]
}
],
buttons:[
{text: ' Save ',
HANDLER:SUBM},
{text: ' Cancel '}
]
})
function SUBM () {
if (!main.isvalid ()) {
Return
}
Main.getform (). Submit ({
WAITMSG: ' Data submission ... ',
URL: './php.php ',
Method: ' POST ',
Params:main.getValues (),
Success:function (form,action) {
Alert ("OK");
},
Failure:function (form,action) {
Alert (');
}
})
}
Service side:
$str =$_post["name"];
$arr =array (
"Name" = "Xiobai",
"Sex" = "28"
);
echo Json_encode ($arr);
?>
Problem he went straight failure: the function behind, why not go success:
Share to:
------Solution--------------------
You alert (form + action);
And not alert (');