How to Access JavaScript variable from Python code in Bottle Template -


i using bottle create dashboard in html control sonos speaker system.

i have volume slider in html/javascript value want use in python function changes sonos speaker volume. however, don't know how access value in python code.

here code:

<input id="vol-control" type="range" min="0" max="100" value="{{volume}}"step="1" oninput="setvolume(this.value)" onchange="setvolume(this.value)"></input>  <script> function setvolume(val) {     %from sonosserver import vol_change     %vol_change(val) } 

when run error "nameerror: name 'val' not defined".

thanks in advance help.

you're confused between frontend , backend code. bottle runs on server; way variable javascript use request, eg via ajax.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -