Advertisement
Guest User

Untitled

a guest
Aug 4th, 2015
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. function(config) {
  2. var config_copy = JSON.parse(JSON.stringify(config));
  3.  
  4. //post cookie
  5. $.ajax({
  6. url: "php/pivot_cookie.php",
  7. type: "POST",
  8. data: config_copy,
  9. success: function(){ alert("Cookie: success") },
  10. error: function(data){alert(data);}
  11. });
  12.  
  13. }
  14.  
  15. $cookie_name = "pivot_config";
  16. $cookie_value = $_POST['config_copy'];
  17. setcookie($cookie_name, $cookie_value, "/");
  18.  
  19. //cookie check function
  20. if(!isset($_COOKIE[$cookie_name])) {
  21. echo "Cookie named '" . $cookie_name . "' is not set!";
  22. } else {
  23. echo "Cookie '" . $cookie_name . "' is set!<br>";
  24. echo "Value is: " . $_COOKIE[$cookie_name];
  25. }
  26.  
  27. $(document).ready(function(){
  28. $.ajax({
  29. url: "php/pivot_cookie.php",
  30. type: "GET",
  31. data: (cookie - I dont know how to get it),
  32. success: function(){ alert("Cookie Retreival: success") },
  33. error: function(data){alert("Cookie Retrieval: failure");}
  34. });
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement