Hello, Can someone help me with this

I am trying to set and catch the url variable

It begins with a form wich has the standard action set to "/autorisation/logout" Then a button with an inline javascript function

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

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

In the autorisation controller I try to catch it

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

but it doesn't work and I can't see the variable in the url and therefore the default forms action is performed?

I also have another redirect page with

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

and that works fine

How can I get the javascript to work because I have three submit buttons that I need to control by using different url variables that I need to read in the controller function. ,wich is logout() in this case.

It is worth mentioning that is has got something to do with the fact that it can not interpet the variable in the uri because it defaults to the index function off that controller wich is the standard behaviour if it can't find the second part. Without the variable attached, it redirects ok.

Is there a solution?

Thanks, Richard

link|flag

78% accept rate

2 Answers

up vote 1 down vote accepted

I think it's as simple as

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

instead of

parent.location = "/autorisation/logout?rcgo=payout";
link|flag
thanks, I hope that works – Richard Mar 12 at 7:35
I found the solution by adding a slash before the questionmark The problem was that I did not know how the pretty url was being parsed. – Richard Mar 12 at 13:55

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); 
link|flag
looks interesting, I will try that also. I am guessing those are basic javascript functions and not jquery? – Richard Mar 12 at 7:39
tizag.com/ajaxTutorial/ajaxxmlhttprequest.php Take a look at that to get a better idea how to "build" the ajax object and handle it a bit. – Alex Mar 13 at 2:44

Your Answer

 
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.