I use jQuery Ajax with php,I get value in json encode in php file but I cant decode in result
<script>
jQuery(document).ready(function() {
jQuery(".upload").click(function(e) {
e.preventDefault();
var data = {};
jQuery(".ajax_elements").each(function(_, elem) {
data[this.id] = this.value;
});
jQuery.ajax({
type: "POST",
url: "map.php",
data: data,
cache: false
}).done(function(result) {
alert(result);
});
});
});
</script>
PHP code
echo json_encode(array('URL'=>'http://test.com'));
here I get {URL:http://test.com} in alert but how to get value of this URL?
I tried jQuery.parseJSON(result); but it shows error in console