导出用JS获取GET参数

 1 $("#export").on('click', function () {
 2     var $this = $(this);
 3     var nameArr = $this.closest('form').find("[name]");
 4     var tempHref = "<?php echo URL::base(true).'wishnewproduct/exportnewproduct'?>?";
 5     nameArr.each(function (i, t) {
 6         if ($(this).attr('type') !== "checkbox" || $(this).prop('checked') === true) {
 7             if (i === 0) {
 8                 tempHref = tempHref + $(this).attr('name') + '=' + $(this).val();
 9             } else {
10                 tempHref = tempHref + '&' + $(this).attr('name') + '=' + $(this).val();
11             }
12         }
13     });
14     window.location.href = tempHref;
15 });

 

posted @ 2016-07-08 10:03  bky2317894314  阅读(260)  评论(0编辑  收藏  举报