Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
- </head>
- <body>
- <input type="checkbox" class="onoffswitch-checkbox" name="onoffswitch-checkbox" id="onoffswitch-checkbox"> I have a bike<br>
- <script>
- $(document).ready(function() {
- $(".onoffswitch-checkbox").click(function() {
- var id = this.id; //changed here also, just because jQuery is not needed here
- var state = this.checked ? 1 : 0;
- $("#state_span").load("aj.php?id="+id+"&state="+state);
- });
- });
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment