library/Helper/Ajax.php
public function localize($var, $handle = null)
    {
        if(! isset($this->data) || ! $this->data || is_string($var) == false) {
            return false;
        }

        if($handle !== null) {
            $this->handle = $handle;
        }

        $this->var = $var;

        add_action( 'wp_enqueue_scripts', array($this, '_localize') );

        return true;
    }
public function localize($var, $handle = null)
    {
        if(! isset($this->data) || ! $this->data || is_string($var) == false) {
            return false;
        }

        if($handle !== null) {
            $this->handle = $handle;
        }

        $this->var = $var;

        add_action( 'wp_enqueue_scripts', array($this, '_localize') );

        return true;
    }
public function localize ( $ var , $ handle = null ) { if ( ! isset ( $ this -> data ) || ! $ this -> data || is_string ( $ var ) == false ) { return false ; } if ( $ handle !== null ) { $ this -> handle = $ handle ; } $ this -> var = $ var ; add_action ( 'wp_enqueue_scripts' , array ( $ this , '_localize' ) ) ; return true ; }
Localize - Pass data from PHP to JS
@param  $var - Define variable name used in JS file
@param  $handle - Specify script handle (optional)
@return boolean
Localize - Pass data from PHP to JS