如何使用jquery将Json编码加载到变量中

How do I load Json encode into a variable with jquery

本文关键字:加载 变量 编码 Json 何使用 jquery      更新时间:2023-09-26

我有一个包含编码数组的页面"jsonencode.php"

[["Easth1","North1","A","URL1"],["Easth2","North2","B","URL2"]]

我知道我可以用在html中加载到div中

$("#div").load("jsonencode.php");

但我想做的是将数组加载到一个变量中,比如:

var a = load("jsonencode.php");
jQuery.getJSON('jsonencode.php', function(obj) {
    //obj not holds your parsed JSON as a JS object
});

http://api.jquery.com/jquery.getjson/