Here is my javascript variable my
, i wanted to get it from php file.
Inside the selectAnnotation.php
i am just echoing 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;
As, i wanted to get it from php file. To achieve it I made a 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('__________');
//anno.addAnnotation(data);
});
While doing this, I can see the difference in console..
Here is the screen of what happens i do console log of console.log(my)
and console.log(data)
So, how can i make the proper response which appears like inside the console.log(my)
Note :
The var my
is the proper format that i need, I wanted to get the same format posted from 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 am getting almost same like previous one..