简体   繁体   English

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

[英]How do I load Json encode into a variable with jquery

I have a page "jsonencode.php" containing encoded arrays我有一个包含编码数组的页面“jsonencode.php”

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

I know I can load in html in to a div with:我知道我可以将 html 加载到 div 中:

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

but I want to do is load arrays into a variable like:但我想做的是将数组加载到一个变量中,例如:

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/ http://api.jquery.com/jquery.getjson/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM