2011-06-06 33 views
-1

我有这个表有没有更好的办法来重定向和传递参数

<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> 

费利克斯·克林阅读后 我的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

+0

而你不希望有'在地址栏中显示path'? – 2011-06-06 07:56:52

+0

@Felix Kling:是的,页面重定向后,路径在我的地址栏中仍然可见,我不想要 – abi1964 2011-06-06 08:03:55

+1

你需要哪个路径值?服务器端还是客户端?你为什么不做POST请求? – 2011-06-06 08:07:22

回答

0

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

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(); 
}); 
+0

不是说acrion应该在

中采取行动。 – 2011-06-06 08:18:23

相关问题