jsp - sending an AJAX post request to another page -
i'm newbie in web development , problem when click on "my link"it gives me "bad request" because of huge number of variables in ids. -how should change code send post request? -any better solution handle case?
thank you
<!doctype html "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <%@page contenttype="text/html" pageencoding="utf-8"%> <% string var3 = request.getparameter("var3"); string var4 = request.getparameter("var4"); string var5 = request.getparameter("var5"); %> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>title</title> <link rel="stylesheet" href="../style.css"/> <link rel="stylesheet" href="../common/css/cupertino/jquery-ui-1.8.4.custom.css" type="text/css" media="screen" /> <script type="text/javascript" language="javascript" src="../common/scripts/jquery/jquery-1.6.1.min.js"></script> <script type="text/javascript" language="javascript" src="../common/scripts/jquery/jquery-ui-1.8.4.custom.min.js"></script> <script type="text/javascript" language="javascript" src="../common/scripts/jquery/jquery.dialogextend.js"></script> <script type="text/javascript" language="javascript" src="../common/scripts/troubleshoot.js"></script> <script type="text/javascript"> var selectedvariables = function(event, ui) { var var1 = $('#tbodyvar1 .ui-selected'); if (var1.size() <= 0) { $('#var1menu').addclass('var2'); $('#novar1menu').removeclass('var2'); } else { var ids = ''; var1.each(function () { if (ids.length > 0) { ids += ','; } ids += $(this).find("td").eq(0).html();; }); $('#var1menu').removeclass('var2'); $('#novar1menu').addclass('var2'); $('#totalvar1').html(var1.size()); $('#somelink').attr('href', 'anotherjsp.jsp?action=init&var3=<%=var3%>&var4=<%=var4%>&var5=<%=var5%>&ids=' + ids); } }; $(document).ready(function() { $('.popup').click(function(e) { e.preventdefault(); var $this = $(this); var horizontalpadding = 30; var verticalpadding = 30; $('<iframe id="externalsite" class="externalsite" src="' + this.href + '" />').dialog({ title: ($this.attr('title')) ? $this.attr('title') : '', autoopen: true, width: 560, height: 600, modal: false, resizable: false, autoresize: true, overlay: { opacity: 0.5, background: "black" } }).dialogextend({ "maximize" : true, "icons" : { "maximize" : "ui-icon-circle-plus" }, "events" : { "maximize" : function(evt, dlg){ window.open(this.src); $(this).dialog("close"); } } }).width(560 - horizontalpadding).height(600 - verticalpadding); }); $('.popup2').click(function(e) { e.preventdefault(); var $this = $(this); var horizontalpadding = 30; var verticalpadding = 30; $('<iframe id="externalsite" class="externalsite" src="' + this.href + '&hideheader=true" />').dialog({ title: ($this.attr('title')) ? $this.attr('title') : '', autoopen: true, width: 800, height: 600, modal: false, resizable: false, autoresize: true, overlay: { opacity: 0.5, background: "black" } }).width(800 - horizontalpadding).height(600 - verticalpadding); }); $("#tbodyvar1").selectable({ filter: "tr:not(.ui-notselectable)", cancel: 'a', stop: selectedvariables }); $("#tbodyvar6").selectable({ filter: "tr:not(.ui-notselectable)", cancel: 'a', stop: selectedvariables2 }); $("div#info").hide(); }); </script> </head> <body> <h1>h1</h1> <div id="var1menu" class="var2" style="padding:10px 0 0 10px"> <ul> <li> <a id="somelink" href="#" class="popup2" target="_blank">my link</a> </li> </ul> </div> </body> </html>
Comments
Post a Comment