2011-06-06 32 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

相關問題