0

我正在尝试设置和捕获 URL 变量

它以一个将标准操作设置为“/autorisation/logout”的表单开始,然后是一个带有内联 JavaScript 函数的按钮

function tbPayout()
{
parent.location = "/autorisation/logout?rcgo=payout";
return true;

} 
<input src="/images/go02.gif" type=image border=0 name="go1" onClick="return tbPayout();">

在授权控制器中,我尝试抓住它

if ( isset($_GET['rcgo']) ) {

但它不起作用,我在 URL 中看不到变量,因此执行了默认表单操作?

我还有另一个重定向页面:

content="3; url=http://www.domain.nl/index/index?rcgo=logout" />

这很好用。

我怎样才能让 JavaScript 工作,因为我需要使用需要在控制器函数中读取的不同 URL 变量来控制三个提交按钮。在这种情况下是 logout() 。

值得一提的是,这与它无法解释 URI 中的变量这一事实有关,因为它默认为该控制器之外的索引函数,如果找不到第二部分,这是标准行为。如果没有附加变量,它会重定向。

有解决办法吗?

4

2 回答 2

1

Another option is using AJAX to pass as GET/POST directly...

var queryString = "?rcgo=payout";
ajaxRequest.open("POST", "/autorisation/logout" + queryString, true);
ajaxRequest.send(null); 
于 2010-03-12T04:35:18.067 回答
1

我认为这很简单

parent.location.href = "/autorisation/logout?rcgo=payout";

代替

parent.location = "/autorisation/logout?rcgo=payout";
于 2010-03-12T03:47:46.890 回答