日期:2014-05-16  浏览次数:20333 次

关于jquery.post方法中参数的问题
$.post('aaa.aspx',{aaa:'111',bbb:'222'},function(result){alert(result);});

var strParams = {aaa:'111',bbb:'222'};
$.post('aaa.aspx',strParams,function(result){alert(result);});

前者可以,后者不行,jquery.post中的参数不能用变量代替吗?只能写死吗?可我的参数是动态的,不一定个数,怎么办????
jquery.post

------解决方案--------------------
var $strParams = {aaa:'111',bbb:'222'};
$.post('aaa.aspx',$strParams,function(result){alert(result);});

这样试试。