码迷,mamicode.com
首页 > Web开发 > 详细

解析url动态构建form提交表单

时间:2016-07-07 12:27:34      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:

<a id ="rnavLink" href ="#"  postURL="http://localhost:8080/GE/jsp/PclYxAction.jsp?DATATYPE_OP=&DATATYPE_COND=&DATATYPE_COND2=&DESCRIPTION_OP=&DESCRIPTION_COND=&DESCRIPTION_COND2=&FIELDNAME_OP=&FIELDNAME_COND=&SOURCENAME_OP=&SOURCENAME_COND=&PAGESIZE=10&ENQUIREID=test2&SYS.USERID_COND=null&SYS.PROCESSDATE_COND=null&ORDERBY_CNT=0&FUNCID=0&runbatButton=1" target="_blank">搜索</a>

$(document).ready(function() {
$(‘#rnavLink‘).click(function() {
var p = $(this).attr(‘postURL‘).split(‘?‘);
alert(p);
var action = p[0];
var params = p[1].split(‘&‘);
var form = $(‘<form/>‘, {action:action, method:‘post‘}).appendTo(‘body‘);
for (var i in params) {
var tmp = params[i].split(‘=‘);
var key = tmp[0], value = tmp[1];
$(‘<input/>‘, {type:‘hidden‘, name:key, value:value}).appendTo(form);
}
alert(form);
$(form).submit();
return false;
});
});

解析url动态构建form提交表单

标签:

原文地址:http://www.cnblogs.com/leiyf/p/5649461.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!