有没有更好的方法来重定向和传递参数

时间:2011-06-06 07:55:07

标签: javascript jquery

我有这张桌子

<table id="tableDg" border=1>
 <tbody>
 <tr>
  <td ><input type="hidden" id="path" readonly="true" value="{path}">{path}</input></td>
<td><input type="checkbox" class = "chkbCsm" ></input></td>
  <td ><input type="hidden" id="nameText" readonly="true" value="{name}"><a href="#"  class="aDg">{name}</a></input></td> 
     <td ><input type="hidden" id="nameText" readonly="true" value="{host}">{host}</input>     </td> 
  </tr>
 </tbody>
</table>

阅读 Felix Kling 的帖子后 我的jQuery

$('#tableDg tbody tr td a.aDg').live('click', function(){
    path=$('input', $(this).parent().prev().prev()).val();
    window.location.href = "/simon/infopage.html";

     var url_action="/getData";
     var client; 
     var dataString;

     if (window.XMLHttpRequest){ 
         client=new XMLHttpRequest();
     } else {                    
         client=new ActiveXObject("Microsoft.XMLHTTP");
     }

     client.onreadystatechange=function(){

         if(client.readyState==4&&client.status==200)
         {
                   //here i will get back path in infopage.html
         }
     };

     dataString="request=getconfigdetails&path="+path;
     client.open("POST",url_action,true);
     client.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

     client.send(dataString);

});

这是我应该从上一页path

获取infopage.html

2 个答案:

答案 0 :(得分:0)

您可以让第一页设置一个cookie,然后重定向并在另一页上阅读。

答案 1 :(得分:0)

你可以做出类似的事情:

$('#tableDg tbody tr td a.aDg').live('click', function(){
    $('#tableDg').append('<form action="/simon/infopage.html" id="myform" method="post"> place some inputs here </form>');
    $('#myform').submit();
});
相关问题