Announcement

Collapse
No announcement yet.

Print data in console

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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!

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

    Comment


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

      Comment


      • #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


        • #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


          • #6
            Thanks tarasm, it works!!

            Comment

            Working...
            X