Guest User

Untitled

a guest
Apr 28th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. <html>
  3. <head>
  4. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
  5.  
  6.  
  7. </head>
  8. <body>
  9. <input type="checkbox" class="onoffswitch-checkbox" name="onoffswitch-checkbox" id="onoffswitch-checkbox"> I have a bike<br>
  10.  
  11.  
  12. <script>
  13. $(document).ready(function() {
  14.     $(".onoffswitch-checkbox").click(function() {
  15.         var id = this.id;  //changed here also, just because jQuery is not needed here
  16.         var state = this.checked ? 1 : 0;
  17.         $("#state_span").load("aj.php?id="+id+"&state="+state);
  18.     });
  19. });
  20. </script>
  21.  
  22.  
  23.  
  24. </body>
  25. </html>
Add Comment
Please, Sign In to add comment