We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi,
Thanks for helping. Here is my code:
var data;
function preload() {
data = loadJSON("json.json");
}
function setup() {
noCanvas();
// var overdenking = data.Articles[1].Title;
var overdenking = data.Articles;
for (var i = 0; i < overdenking.length; i++){
createElement('h1', overdenking[i].Title);
createElement('p', overdenking[i].Date);
}
}
Right now, it just loads on the page, I assume on the body tag. I would like it to load in a div, the p5Container div, if possible. Do I do this with data.parent('p5Container');? If so, where should it be placed because I tried everywhere.
Thanks
Answers
https://Forum.Processing.org/two/discussion/15473/readme-how-to-format-code-and-text
http://Bl.ocks.org/GoSubRoutine/7a567f0510b338b6d0fc1ef53f24f10e
https://Forum.Processing.org/two/discussion/22414/trouble-loading-json-data-from-a-url#Item_6
Thanks. I have read the articles but I haven't found the answer I am looking for, I am new to P5. Would you mind explaining?
Ah I got it.
It works, but a little too well. My navigationbar dissapeared. Any ideas on how to get it back?
Thanks
Some notes: L-)
createElement('p', '')
w/ justcreateP('')
: https://p5js.org/reference/#/p5/createPhttps://Forum.Processing.org/two/discussion/22414/trouble-loading-json-data-from-a-url#Item_6
createDiv(''.fontcolor(COLOR).bold().big());
elem = select('font');
for (const crew of issCrewNames) createP(crew).parent(elem);
Thanks, I'll look into that. Just created a new post because this one said answered. Sorry.
A more simplified mock example: O:-)
Avoid creating new posts for the very same thing. :(|)
It diverts attention and splits answers everywhere! :-&
And btW, choose a more appropriate category for a question posting. (:|
But I do need the H1 and p tag within the div. I don't see how this fixes that.
Actually, what I need is this: < ul> < a href>< li>Title - Date< /li>< /a> < a href>< li>Title - Date< /li>< /a> < /ul>
Sorry, I couldn't get that into code mode. Basically a ul list with list items that contain the title and the date. My current list only makes h1 title tags and paragraph tags. Can you help me? This is my current code:
}
Great idea, here is the sketch: https://openprocessing.org/sketch/442004
You need to activate the slider for p5.dom library for your sketch there! 8-X
I did
https://
secure option, you can't use https://OpenProcessing.org to grab its JSON file! :o3http://
in place ofhttps://
to run our gists there! \m/bl.ocks.org can't find the file, so that's not gonna work either https://gist.github.com/christiannolles/54ec11efd9ed891b8f3332ea410276e6 https://bl.ocks.org/christiannolles/54ec11efd9ed891b8f3332ea410276e6
Of course, you're gonna need to provide an "index.html" there which loads both p5 & p5.dom, plus the "sketch.js" files. L-)
Use mine from: http://Bl.ocks.org/GoSubRoutine/7a567f0510b338b6d0fc1ef53f24f10e ;;)
Thanks that worked. Stupid of me. Here it is: http://bl.ocks.org/christiannolles/6073d450ec899cb12dd7776162dea1bd and my index file is here: https://gist.github.com/christiannolles/6073d450ec899cb12dd7776162dea1bd
Sorry guys, have never done this before. Here is a new link: https://gist.github.com/christiannolles/4ec87aac4303e2c5fefed51b362529d3
and : http://bl.ocks.org/christiannolles/4ec87aac4303e2c5fefed51b362529d3
Strange thing is, I only see one title.
If you hit F12 to open browser's console at your Bl.ocks.org gist, you're gonna see there: 3:-O
"Uncaught (in promise) ReferenceError: p5Container is not defined"
That is fixed now. I left .block blank because I didn't know what to put in. Does anyone know how to get me from this place to what I need? What I need is seen here: https://gist.github.com/christiannolles/f5a6c7a213ff3e2f0a4960cb0d643767
As you may have noticed, my own Gist example uses elements
<ol>
&<li>
:http://Bl.ocks.org/GoSubRoutine/7a567f0510b338b6d0fc1ef53f24f10e
I don't get your example at all or how I should apply this to my code. I am new to this. Could you maybe make some direct suggestions as to how I should improve on what I have so far?
By the way, GoToLoop, I can't get the link working so I can't use it as an example... Do you know what's wrong?
http://bl.ocks.org/GoSubRoutine/7a567f0510b338b6d0fc1ef53f24f10e
It works perfectly for me. Dunno why it wouldn't for ya: :-/
createElement('h1', overdenking[i].Title).parent(p5Container);
https://www.TJVantoll.com/2012/07/19/dom-element-references-as-global-variables/
I ran the code of GoToLoop on my own server and I get this error:
The result is a blank page. Any ideas?
For such error, you're probably using some old (about 1 year) Firefox-based browser.
Download a more updated 1 right way! :!!
Using chrome, it works.
Still, you should update your Firefox browser. O:-)
Just forked your gist sketch, re-modeling it after my "JSON Open-Notify" sketch: :D
http://Bl.ocks.org/GoSubRoutine/bef70ffdae5e1a052ade9c6b15f737cc
index.html:
sketch.js:
New version 2! Now w/ clickable thumbs which open their corresponding devotional article's link: \m/
http://Bl.ocks.org/GoSubRoutine/bef70ffdae5e1a052ade9c6b15f737cc
index.html:
sketch.js: