Home >Backend Development >PHP Tutorial > extjs+php ,大家来看看是小弟我的json输出的有关问题,还是小弟我的extjs没有写对呢

extjs+php ,大家来看看是小弟我的json输出的有关问题,还是小弟我的extjs没有写对呢

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:36:36837browse

extjs+php ,大家来看看是我的json输出的问题,还是我的extjs没有写对呢?
客户端:主要是看我鞋底subm这个函数有没得问题,

var main=new Ext.FormPanel({<br />
	title:'用户注册',<br />
	width:500,<br />
	frame:true,<br />
	bodyStyle:'margin:10px;',<br />
	renderTo:'tool',<br />
	height:400,<br />
	<br />
	items:[<br />
		{<br />
			layout:'column',<br />
			border:false,  <br />
			items:[<br />
				{	columnWidth:.4,<br />
					xtype:'textfield',<br />
					fieldLabel:'姓名',<br />
					labelWidth:30,<br />
					regex:/^[0-9a-zA-Z\.]+$/,<br />
					regexText:'只能是字母',<br />
					regexTextWidth:300,<br />
					allowBlank:false,<br />
					name:'name'<br />
					<br />
				},{<br />
					columnWidth:0.6,<br />
					layout:'column',<br />
					bodyStyle:'margin-left:20px',<br />
					border:false,<br />
					items:[<br />
				<br />
				{<br />
					columnWidth:.2,<br />
					xtype:'checkbox',<br />
					name:'aihao',<br />
					boxLabel:'足球',<br />
				},<br />
					{<br />
					columnWidth:.2,<br />
					xtype:'checkbox',<br />
					name:'aihao',<br />
					boxLabel:'踢足球'<br />
				}<br />
					<br />
				]<br />
			}<br />
			]<br />
		<br />
		}<br />
	<br />
	],<br />
	buttons:[<br />
			{text:'保 存',<br />
			 handler:subm},<br />
			 {text:'取 消'}<br />
		]<br />
	<br />
	<br />
	<br />
	<br />
	})<br />
<br />
function subm(){<br />
	 <br />
	  if (!main.isValid()) {  <br />
               return;  <br />
          }<br />
	    		main.getForm().submit({<br />
            	waitMsg:'数据提交中....',<br />
            	url:'./php.php',<br />
            	method:'POST',<br />
				params:main.getValues(),<br />
          	success:function(form,action){<br />
				alert("ok");<br />
            },<br />
                failure:function(form,action) {<br />
				alert('');<br />
            }<br />
        })<br />
<br />
	<br />
	<br />
	<br />
	}<br />


服务端:
<?php<br />
$str=$_POST["name"];<br />
$arr=array(<br />
"name"=>"xiobai",<br />
"sex"=>"28"<br />
);<br />
echo json_encode($arr);<br />
<br />
?>


问题他直接走failure:后面的函数,为什么不走success:

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn