Welcome Guest, Not a member yet? Register   Sign In
How to do nothing ? :)
#1

[eluser]cybersven[/eluser]
Introduction :
I navigate through my application only with the Keyboard.
Each key is a link

In my controller, I'm testing a condition like this before rendering the page :
Code:
if($data["results"]==TRUE)
        {
  $this->render_page('home/index', $data);
}
I would like to do nothing if condition is FALSE, I mean even if you press a key, you will stay on the page.
Actually if condition is FALSE I got a blank page after pressing a key
A refresh or redirection on the same page, will create a loop...

How can I solve this ?
#2

[eluser]jonez[/eluser]
Are you using AJAX? In your key binding make an AJAX call to see if you should change pages, in the callback if you receive true (yes) redirect the user using [removed]. If false (no) do nothing.

If you do it only using PHP you'll have to store the previous URL in a session/cookie (or use the agent referrer) and redirect back to the previous step when you hit your false condition.




Theme © iAndrew 2016 - Forum software by © MyBB