I have a JSON object which I encoded in Python. I don't know if I am doing the encoding right or not.
proc = subprocess.Popen(['sshpass',
'-p',
password,
'rsync',
'-avz',
'--info=progress2',
source12,
destination],
stderr=subprocess.PIPE,
stdout=subprocess.PIPE).communicate()[0]
progress = json.dumps(proc)
return HttpResponse(progress, mimetype="application/json")
I want to use the object 'progress' in the JAVASCRIPT to show the progress bar in the Django template. How it can be done? Thanks
I am trying to implement it in a Django template like this:
<script type="text/javascript" language="javascript">
function popUp() {
var jsProgress = JSON.parse(progress)
document.write(jsProgress)
}
</script>
But this shows nothing.