Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

django button

<html>
    <head>
        <title>An example</title>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
        <script>
            function call_counter(url, pk) {
                window.open(url);
                $.get('YOUR_VIEW_HERE/'+pk+'/', function (data) {
                    alert("counter updated!");
                });
            }
        </script>
    </head>
    <body>
        <button onclick="call_counter('http://www.google.com', 12345);">
            I update object 12345
        </button>
        <button onclick="call_counter('http://www.yahoo.com', 999);">
            I update object 999
        </button>
    </body>
</html>
Comment

PREVIOUS NEXT
Code Example
Python :: how to find greatest number in python 
Python :: how to add pagination in discord.py 
Python :: check if value is in series pandas 
Python :: Counter() Function 
Python :: speech enhancement techniques 
Python :: loops in python 
Python :: discord py server.channels 
Python :: explode function in python 
Python :: pytest fixture 
Python :: Replace an item in a python list 
Python :: loading bar 
Python :: Removing Elements from Python Dictionary Using popitem() method 
Python :: include app in django project 
Python :: python strip function 
Python :: show percentage in seaborn countplot site:stackoverflow.com 
Python :: django-filter for multiple values parameter 
Python :: python online compiler 
Python :: how to index lists in python 
Python :: exponent function in python 
Python :: merge list elements python 
Python :: convert date to string in python 
Python :: js choice function 
Python :: Routes In Django 
Python :: run python on android 
Python :: django for beginners 
Python :: python OSError: [Errno 22] Invalid argument: 
Python :: self keyword in python 
Python :: Python NumPy concatenate Function Syntax 
Python :: Send Axios With Post 
Python :: python 3.8 vs 3.10 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =