Using JSON from Processing-JS

I want to write an application using processing-JS , and I would like to be able to load it using server data, I have not written the server part yet, so I can use anything, but it seems obvious that AJAX will use JSON to load data on page.

How can I access this data from my processing code? Is it something as simple as data in scope or can it be bound to a window object and directly accessible from processing code?

Refresh . Let me clarify the question a bit. I like JSON (but thanks for the links) and with writing code for the client and server; my real question (which admittedly might be a little silly) is this: if I get data from, for example, jQuery and want to manipulate it in js processing, is it in the same namespace? Do I have to do anything special to access it?

+3
source share
5 answers

"sloppily" JavaScript. , , , , JavaScript , " ".

http://processingjs.org/reference/articles/best-pratice

+6

jQuery, this JSON , . , JS jQuery .

+1

, www.json.org
, json , -.
, -, json.
, java- JSON. , , , -. , , javascript javascript javascript

+1

, , . processing.js. , , JSON javascript .

, JSON. XML, XPath , , - .

+1

JQuery/Javascript Processing.js, scope.getInstanceById, PApplet (, javascript):

// get a reference to the Processing PApplet object:
var proc = Processing.getInstanceById("the_id_of_your_canvas");

, , :

// call any function that is defined inside the Processing sketch
// in this case, one of the built in ones:
proc.frameRate(4);

So, you write JSON analysis code in Javascript / JQuery and then you can pass data to process such functions.

+1
source

Source: https://habr.com/ru/post/1708006/


All Articles