Here is my javascript variable my, I wanted to get it from a php file.
Inside selectAnnotation.phpI just repeat it
echo "{
src : 'http://192.168.1.58/annotate/drive/image/test.jpg',
text : 'Suresh and Gopinath....',
shapes : [{
type : 'rect',
geometry : { x : 0.1825726141078838, y: 0.23756906077348067, width : 0.11602209944751381, height: 0.11618257261410789 }
}]
}";
exit;
Like, I wanted to get it from a php file. For this, I made an ajax call
var my = {
src : 'http://192.168.1.58/annotate/drive/image/<?php echo $_GET['file']?>',
text : 'Suresh and Gopinath....',
shapes : [{
type : 'rect',
geometry : { x : 0.1825726141078838, y: 0.23756906077348067, width : 0.11602209944751381, height: 0.11618257261410789 }
}]
}
console.log(my);
console.log('__________');
$.post("masterCall/selectAnnotation.php",
{ url: 'http://192.168.1.58/annotate/drive/image/<?php echo $_GET['file']?>'
},
function(data,status){
console.log(data);
console.log('__________');
});
However, I see a difference in the console.
Here is a screen of what happens, I am making a console log console.log(my)andconsole.log(data)

So how can I make the correct answer that appears both inside console.log(my)
Note:
var my is the correct format that I need, I wanted to get the same format that was sent from the php file and get it in jquery.
Update:
When i try to do
$v = "{
src : 'http://192.168.1.58/annotate/drive/image/test.jpg',
text : 'Suresh and Gopinath....',
shapes : [{
type : 'rect',
geometry : { x : 0.1825726141078838, y: 0.23756906077348067, width : 0.11602209944751381, height: 0.11618257261410789 }
}]
}";
echo json_encode($v);
and in jquery
function(data,status){
var obj = jQuery.parseJSON( data);
console.log(obj);
});
I get almost the same as the previous one.