extjs ajax 返回值如何写
varvalues=Ext.getCmp('form').getForm().getValues();//获取form里textfield、radio等值Ext.Ajax...
var values = Ext.getCmp('form').getForm().getValues(); //获取form里textfield、radio等值
Ext.Ajax.request({
url: 'addmysql.php', //资料重复不写入资料库,反之写入资料库
method: "post",
params:values,
success: function(response){
Ext.Msg.alert("成功",response.responseText)
},
failure: function(){Ext.Msg.alert("失败");}
});
我想请问如何判断是否有写入资料库,该如何写,谢谢! 展开
Ext.Ajax.request({
url: 'addmysql.php', //资料重复不写入资料库,反之写入资料库
method: "post",
params:values,
success: function(response){
Ext.Msg.alert("成功",response.responseText)
},
failure: function(){Ext.Msg.alert("失败");}
});
我想请问如何判断是否有写入资料库,该如何写,谢谢! 展开
1个回答
展开全部
function classSchool(value){
var result;
Ext.Ajax.request({
url:'test.aspx?cmd=getclsh',
params:{classID:value},
success:function(response,result){
var data = Ext.decode(response.responseText);
result = data.value;
alert(result+'____');
},
failure:function(){
Ext.Msg.alert('提示','数据库连接错误!');
return 0;
}
});
return result;
}
alert(classSchool('11111'));
后台:
if (cmd == "getclsh")
{
string classID = Request["classID"].ToString().Trim();
res = "{value:'22222'}";
Response.Write(res);
Response.End();
}
var result;
Ext.Ajax.request({
url:'test.aspx?cmd=getclsh',
params:{classID:value},
success:function(response,result){
var data = Ext.decode(response.responseText);
result = data.value;
alert(result+'____');
},
failure:function(){
Ext.Msg.alert('提示','数据库连接错误!');
return 0;
}
});
return result;
}
alert(classSchool('11111'));
后台:
if (cmd == "getclsh")
{
string classID = Request["classID"].ToString().Trim();
res = "{value:'22222'}";
Response.Write(res);
Response.End();
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询