Search code examples
atk4

js() funcion and html characters


Im using $this->js(true, 'your js here');, but have a problem:

If certain conditions are met, i redirect page to something else, with js function like this:

top.location = "http://some-url.com?param1=AAA&param2=BBBB"

but & character converts to: &

I know i can use $this->api->redirect('some-url', array('param1'=>AAA, 'param2'=>BBB)); But for some reasons i have to use js function, but only to write html characters properly.. How to acomplish this?


Solution

  • The proper way to do this:

    if($condition){
    
      $this->js(true)->univ()->location('http://some-url.com?param1=AAA&param2=BBBB');
    
    }
    

    More information here: http://book.agiletoolkit.org/js/univ.html