您的位置:首页 > 其它

用ajax传递参数时构建参数对象的方式

2014-05-25 15:25 274 查看
function saveChange(){

if(checkBeforeSave()==true){

  

var msg="您确认添加或者修改指标吗?";

Ext.MessageBox.confirm('确定', msg, function(result){

if(result=='yes'){

                 

var indexId = $("#indexId");

// alert(checkBeforeSave());

var params = {};

var url = "/index!addIndex.action";

var op = "add";

if($.trim(indexId.val())!=""){

url = "/index!updateIndex.action";

op = "update";

params["index.indexId"]= indexId.val();

}

params["index.parIndexId"] = $("#parIndexId").val();

var str="";

$('input[name=statisticCycle]').each(function(){

if($(this).is(":checked")){

str+=this.value+";";

}

});

if(str.length>0){

str=str.substr(0,str.length-1);

}

params["index.statisticCycle"]=str;

//构建[b]参数[/b]

$("#indexInfo input").each(function(){

var me = $(this);

if(me.attr("type")=="text")

params[me.attr("name")]=me.val();

});

$("#indexInfo select").each(function(){

var me = $(this);

params[me.attr("name")]=me.val();

});

$("#…………………………………………………………………………
原作者:http://www.verydemo.com/demo_c107_i2689.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: