django button

Solutions on MaxInterview for django button by the best coders in the world

showing results for - "django button"
Louis
01 Nov 2019
1<html>
2    <head>
3        <title>An example</title>
4        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
5        <script>
6            function call_counter(url, pk) {
7                window.open(url);
8                $.get('YOUR_VIEW_HERE/'+pk+'/', function (data) {
9                    alert("counter updated!");
10                });
11            }
12        </script>
13    </head>
14    <body>
15        <button onclick="call_counter('http://www.google.com', 12345);">
16            I update object 12345
17        </button>
18        <button onclick="call_counter('http://www.yahoo.com', 999);">
19            I update object 999
20        </button>
21    </body>
22</html>
23