无法检索Json信息

时间:2014-04-16 23:40:59

标签: javascript php mysql json

尝试检索JSON数组,但页面只是回显“Null”

以下是我用来检索Json变量的代码

    <?php
function getSystem($address)

    {

        $data_location = "/r10database/checkSystem/index.php?theaddress=".$address;
        $data = file_get_contents($data_location);


        $data = json_decode($data);

        $system = $data->system;

        var_dump($system);



    }
getSystem("Blvd");
?>

这是我的代码来编码我的json变量

function changeElement(contentString,address){


var addressObject = new Array();
addressObject[0]=contentString;

var json_str = JSON.stringify(addressObject); 
var obj = JSON.parse(json_str)

  $('#insertHere').html(json_str);

}

1 个答案:

答案 0 :(得分:0)

远程API已损坏。

http://pear.coreyjansen.com/r10database/checkSystem/index.php?theaddress=200%20Scurfield%20Blvd

Resource interpreted as Script but transferred with MIME type text/plain: "http://geoxml3.googlecode.com/svn/branches/polys/geoxml3.js". index.php:11
Uncaught SyntaxError: Unexpected token else index.php:116
Uncaught ReferenceError: initialize is not defined index.php?theaddress=200%20Scurfield%20Blvd:132