Print data in console

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • krmn.msg
    Member
    • Jun 2016
    • 36

    Print data in console

    Hi!

    How can I print data in console?? I have tried in various ways and not get it.

    Please help me!!

    Thanks you!
  • worldmiros
    Senior Member
    • Dec 2015
    • 120

    #2
    PHP Code:
     i.e. console.log(this.model.get("name")); 
    

    Comment

    • krmn.msg
      Member
      • Jun 2016
      • 36

      #3
      That does not work in PHP Code. Other idea??

      Comment

      • worldmiros
        Senior Member
        • Dec 2015
        • 120

        #4
        if your are trying to do it in php, then it's "$entity->get("name")". Use https://github.com/espocrm/documenta...lopment/orm.md as a guide if you want to get an entity or it's fields. Below is an example as to how to get data from a controller via ajax.
        PHP Code:
        //directory => controllers
        //entityname => Call
        
        //In php
        public function actionTest($params,$data,$request){
        return json_encode(array("test" => "success"));
        }
        
        //In js
        
        $.ajax({
         url: "Call/action/Test"
        }).done(function(resp){
         console.log(resp);
        }.bind(this)) 
        

        Comment

        • tarasm
          Super Moderator
          • Mar 2014
          • 573

          #5
          Please try
          PHP Code:
          echo '<pre>';
          var_dump($entity->toArray());
          exit; 
          
          and open web browser console and see the result.
          Job Offers and Requests

          Comment

          • krmn.msg
            Member
            • Jun 2016
            • 36

            #6
            Thanks tarasm, it works!!

            Comment

            Working...