I've got this JavaScript here:
$('#takePicturebtn').click(function()
{
var injectImage = function(id, url) {
var z = document.getElementById(id);
z.src=url;
};
injectImage("pic", $.getJSON('/picture'));
});
The $.getJSON('/picture')
needs some time to be executed and return the image link. Is it possible to give some time/delay to be executed and then carry on with the process?
Flask function:
@app.route("/picture")
def picture():
link = interact().ftpSession('/home/pi/AlarmwebNew/pictures/' + interact().grabPicture(), interact().grabPicture())
return jsonify(pictureLink=link)