Launch the function loadJSON() with a html button

I see…
the URL, and my code, works :slight_smile: ; I have tried them with the preload function :

	        var jsonData;

		function preload(){
			var url = 'https://api.archives-ouvertes.fr/search/?q=title_t:(javascript)&wt=json';
			jsonData = loadJSON(url);
		}

		function setup(){
			noCanvas(), noLoop();				
		}

		function draw(){
			var data = jsonData.response.numFound;
			var feedback ; 
			if(data != 0) feedback = 'the URL works';
			else feedback = 'the URL did not work';
			createP(feedback);
		}
		

maybe the problem is in the articulation of functions. In the reference examples, the URL can be load in the preload function, or in the setup function, but is it possible to loadJSON() in a draw function ?