用jquery将数据post到新窗口

用jquery将数据post到新窗口

 1 function openBlank(action,data,n){
 2     var form = $("<form/>").attr('action',action).attr('method','post');
 3     if(n)
 4         form.attr('target','_blank');
 5     var input = '';
 6     $.each(data, function(i,n){
 7         input += '<input type="hidden" name="'+ i +'" value="'+ n +'" />';
 8     });
 9     form.append(input).appendTo("body").css('display','none').submit();
10 }

用法:
openBlank('/member/succeed.html',{id:'6',describe:'添加控制器, 包括前台与后台',money:$('.money:first').text()});
posted @ 2012-09-12 13:24  无嗔  阅读(5258)  评论(0编辑  收藏  举报