Localizing script to pass a value to a javascript function

JS variables are not directly replaced as you are expecting. Localizing in your code is correct.

When you do var jsonPath = itajax.ajaxurl;, value of itajax.ajaxurl is assigned to the variable jsonPath.

If you debug this variable in the console, you will get the correct value.
console.log(jsonPath);

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