HOW TO USE eval() FUNCTION HERE
ajax.js
var x="hello world";
var y="anyother string";
$.ajax({
url:"ajax.php",
success:function(data){
console.log($.globalEval(data));
}
});
ajax.php
<?php exit("'first string is '+x+' second one is'+y");?>
I want to return x,y as a variables to ajax response, so console.log(data) can print value of
first string is hello world second one is another string
but it says "x is undefine"
NOTE : I need the solution without passing x and y as data from ajax