how to get permalink

To get a permalink you need to use get_permalink(). Just pass the ID of the post or leave it blank to get the current page in the Loop.

wp_localize_script () will render PHP variables on the page that are consumable by JS through a global object that you define.

PHP

// Register the script
wp_register_script( 'some_handle', 'path/to/myscript.js' );

// Localize the script with new data
$translation_array = array(
    'some_string' => __( 'Some string to translate', 'plugin-domain' ),
    'a_value' => '10'
);
wp_localize_script( 'some_handle', 'object_name', $translation_array );

// Enqueued script with localized data.
wp_enqueue_script( 'some_handle' );

JS

<script>
// alerts 'Some string to translate'
alert( object_name.some_string);
</script> 

The REST-API is also always available for you to extend how you see fit: http://v2.wp-api.org/extending/adding/

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)