Javascript 如何将JSON从链接存储到java脚本数组?

Javascript 如何将JSON从链接存储到java脚本数组?,javascript,php,html,arrays,json,Javascript,Php,Html,Arrays,Json,嗨,我正在尝试将这个JSON存储到我的javascript数组中。有没有办法。我使用下面的代码,但它根本不起作用 我的json 使用JS获取json数据的html代码 <html> <head> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <script src="http://code.jquery.com/jquery-migrate-1.1

嗨,我正在尝试将这个JSON存储到我的javascript数组中。有没有办法。我使用下面的代码,但它根本不起作用

我的json

使用JS获取json数据的html代码

<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script src="http://code.jquery.com/jquery-migrate-1.1.0.min.js"></script>
</head>
<body>
    <div id="response">werer</div>
    <script>
$.get('http://zonewebs.org/website/naveen/source/location.php', function(data) {
  $('#response').append(data);

});
</script>
</dody>
</html>

韦勒
$.get('http://zonewebs.org/website/naveen/source/location.php,函数(数据){
$(“#响应”)。追加(数据);
});

使用JSON.parse将有效的JSON转换为javascript数组

var dataArray = JSON.parse(data);
您的json无效。。从末尾删除此项:

{"var":"stuff"}
然后使用:

JSON.parse(data);

你将使用上面的代码把你的json数据放入一个javascript数组,然后你可以随心所欲地处理它,因为我看到你的json响应,json响应中没有任何属性。使用data.property代替data.property,但它不起作用。我得到的是空白页,而不是jason数据。您使用的是data.property。使用数据$(“#响应”)。附加(数据);??我如何才能删除该部分??
JSON.parse(data);