避免url传值字符串sjstr过长,使用from表单【隐藏域】post提交

1.普通的url传值
<html--------------- <!-- 隐藏域post提交url --> <form id="urlPost" action="${pageContext.request.contextPath}/iwell.disposition.sgt_1.0/newallsgtData.action" method="post"> <input type="hidden" name="jh" value="${jh }"/> <input type="hidden" name="sjstr" id="sjstr" value="${sjstr}" /> <input type="hidden" name="rows" id="pageSize"/> <input type="hidden" name="page" id="pageNumber"/> </form>
-----------------------------
Js代码:
 1     //页面加载自动分页
 2     $(function(){
 3         //var url = "${pageContext.request.contextPath}/iwell.disposition.sgt_1.0/newallsgtData.action?jh=${jh}&sjstr=${sjstr}";
 4         $('#tt').pagination({
 5             total: ${total },showRefresh:false,pageSize:${rows},pageNumber:${page},
 6             onSelectPage:function(pageNumber, pageSize){
 7                 $("#pageSize").val(pageSize);
 8                 $("#pageNumber").val(pageNumber);
 9                 $("#urlPost").submit();
10                 //window.location.href = url+"&rows="+pageSize+"&page="+pageNumber;
11             }
12         });
13         $('#tt1').pagination({
14             total: ${total },showRefresh:false,pageSize:${rows},pageNumber:${page},
15             onSelectPage:function(pageNumber, pageSize){
16                 $("#pageSize").val(pageSize);
17                 $("#pageNumber").val(pageNumber);
18                 $("#urlPost").submit();
19                 //window.location.href = url+"&rows="+pageSize+"&page="+pageNumber;
20             }
21         });

2.  iframe与form的target简单应用From表单隐藏域提交

1 <!--  隐藏域post提交url -->
2 <form id="frameSURL" target="frame_S" action="${pageContext.request.contextPath}/iwell.disposition.sgt_1.0/newallsgtData.action" method="post" style="display: none;">
3             <input type="hidden" name="jh" value="${jh }"/>
4             <input type="hidden" name="sjstr" id="sjstr"/> 
5 </form>
 <!-- 绘制示功图iframe -->
	                 <iframe id="frame_S" name="frame_S" frameborder="0" style="width: 100%;height: 100%;"></iframe>
	            <!-- end -->

 Js

1 function changeSgt(s){
2         //避免url字符串s过长,使用隐藏域post提交    (其中iframe中的name属性 与 from 表单中的target属性值对应)
3         $("#sjstr").val(s);
4         //alert($("#sjstr").val());
5         $("#frameSURL").submit();
6         //alert(s);
7         //$("#frame_S").attr("src","${pageContext.request.contextPath}/iwell.disposition.sgt_1.0/newallsgtData.action?jh=${jh}&sjstr="+s);
8     }

 

 

 

posted @ 2014-09-17 10:40  左手心_疼  阅读(3283)  评论(0编辑  收藏  举报