$.ajax({ url: "xyGet.php", type: "POST", data: ({yget : 1}), dataType: "json", success: function(data){ coord = data.y } }); alert(coord);