简体   繁体   English

如何传递给JS这样的数组这样的对象?

[英]How to pass to JS such array of such objects?

So I need to pass to my script an array of such arrays [name, width, height] and be capable to iterate through such array. 所以我需要向我的脚本传递一个这样的数组[name, width, height]数组[name, width, height]并能够遍历这样的数组。 In what format, how should my server response and how to request(my server can response on any Http and tcp request in any required form.) So I am in search for easiest in implementing on js side. 以什么格式,我的服务器如何响应以及如何请求(我的服务器可以以任何所需的形式响应任何Http和tcp请求。)所以我在js方面寻求最简单的实现。 But I can not use any special JS libs like Jquery. 但我不能使用像Jquery这样的特殊JS库。 (as I said server can form any kind of TCP and HTTP response.) (正如我所说,服务器可以形成任何类型的TCP和HTTP响应。)

So how should look my response to pass such array of arrays to JS and how to read it using JS? 那么应该如何看待我的响应将这些数组数组传递给JS以及如何使用JS读取它?

只需返回JSON

使用JSONP

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

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