Advertisement
Guest User

Untitled

a guest
Apr 24th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. /**These are currently working code***/
  2.  
  3. Choose Colour: <input class="color" name="color1" id="color1" placeholder="click to choose colour">
  4.  
  5. <input type="submit" onclick="changebodycolour('color1')" value="Apply" />
  6.  
  7. /**My function to insert the value to database table**/
  8.  
  9. function changebodycolour(c1)
  10. {
  11. var selectedcolur = document.getElementById(c1).value;
  12. //alert(selectedcolur);
  13. $("#color1").empty();
  14. $("#loginScreen").empty();
  15. $.ajax({
  16.  
  17. url: ""+pat+"changecolour.php?ipp="+encodeURIComponent(selectedcolur),
  18.  
  19. type: 'POST',
  20. beforeSend: function()
  21. {
  22. $('body').css({ opacity: 0.5 });
  23. $("#loading_img").show();
  24.  
  25. },
  26. success: function(data)
  27. {
  28. $("#loading_img").hide();
  29. $("#loginScreen").fadeIn('slow').append(data).delay(1300).fadeOut('slow');
  30. $('body').css({ opacity: 2 });
  31. }
  32. });//end ajax call
  33.  
  34. }
  35.  
  36.  
  37. /**And this is php code**/
  38. $sql = "Insert into gr_colours values('','".$_GET['ipp']."','body')";
  39. $db->insert($sql);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement