Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function(event) {
  2.    
  3.     $('body').on('click', '.firstadd', function(event) {       
  4.        
  5.         var link = $(this);
  6.        
  7.         var first = $(this).attr('data-first');
  8.         successfunc();
  9.         $.ajax({
  10.             url: 'first.php',
  11.             method: 'POST',
  12.             data: {"first" : first}
  13.         })
  14.     });
  15. });
  16.  
  17.  
  18. //php
  19.  
  20. session_start();
  21. $first = $_POST['first'];
  22.  
  23. if (empty($_SESSION['rating'])) {
  24.     $_SESSION['rating'] = [];
  25. };
  26.  
  27. if (!in_array($first, $_SESSION['rating'])) {
  28.    
  29.     $_SESSION['rating'][] = $first;
  30.     $success = 1;  
  31. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement