Codeigniter controller, javascript console.log()

12,887

this links may help you :

http://www.codeforest.net/debugging-php-in-browsers-javascript-console

http://sarfraznawaz.wordpress.com/2012/01/05/outputting-php-to-browser-console/

Share:
12,887
redconservatory
Author by

redconservatory

Updated on June 05, 2022

Comments

  • redconservatory
    redconservatory almost 2 years

    Is there a (simple) way to echo some variables from a Codeigniter controller to the browser console?

    Something like

    public function my_controller_method() {
       if (testing_out_something) {
          $result = "looks like it works";
          $this->log_to_javascript_console->write($result);
       }
    }
    

    I saw this javascript class but it looks like it's more for jQuery, I just want to do something simple for debugging purposes.

    I guess another way would be to send it to a view, but I don't want my view to change at the moment, I just want to make sure my data is being sent.