javascript - How to run a Python script upon button click using mod_python without changing browser window -


i using mod_python publisher set , working fine. allows me run python file in browser , python file has html embedded in it. have defined click-able image input type = "image" onclick = "some action". when click image takes me javascript function performs window.location = "./move" takes me python function. problem browser window redirects function, i. e. localhost/scripts becomes localhost/scripts/move. possible execute script without having browser window change? can post code if needs be.

in fact, i've found using ajax/xmlhttprequest simple , work that, if server python simpleserver style.

you link javascript code button:

// send request, don't refresh page xhttp = new xmlhttprequest(); xhttp.open("get", "?like", true); xhttp.send(); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -