$.ajax({
url: "./instagram/gallery.php",
//force to handle it as text
dataType: "text",
success: function(data) {
//data downloaded so we call parseJSON function
//and pass downloaded data
var json = $.parseJSON(data);
//now json variable contains data in json format
//let's display a few items
$.each(json, function(index, value) {
document.getElementById('backgroundprofile').style.backgroundImage="url("+value.link+")";
});
}
});