javascript - Making URL, that keeps updating which is generated by span and id, clickable and opening in new tab -
i trying make url clickable , open in new window. how url being displayed , updated on html page:
python code:
def data_cb(): return jsonify(waiting=await_take_pic())
javascript code:
jquery(document).ready(function() { var tab = 1; function update_values() { $script_root = {{ request.script_root|tojson|safe }}; $.getjson($script_root+"/_data", function(data) { $("#waiting").text(data.waiting) }); if(tab == 1){ settimeout(update_values, 3000); } }
html code:
<p>picture url update: <span id="waiting"></span></p>
this html line displays url keeps updating pictures being taken. if copy , paste url on new window can display picture.
i have tried sort of combinations , syntax make href, open.window, or onclick make url clickable , opens picture in new window haven't been successful (it needs taken http//...to end of link , placed appears). new python, javascript , html. in fact, first project working them need info , details possible when suggesting answers, please.tia
the easiest solution generate page url pre-set link:
<p>picture <a href="url" target="_blank">url</a> update: <span id="waiting"></span></p>
this make url clickable , open in new window. can adjust image rotation code modify href
attribute needed when image changes.
to make easier access link, add id attribute (e.g. <a id="imagelink" ...>
) can set url like:
document.getelementbyid('imagelink').setattribute('href', url);
Comments
Post a Comment