Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. <form id="form-vote-note-<?php echo $value->id_note; ?>" class="form-vote-note" metod="POST" action="">
  2. <input type="hidden" name="idvote" id="idvote" value="<?php echo $value->id_note; ?>">
  3. <input class="form-check-input" type="radio" name="voteradio" id="voteradio" value="3">
  4. <input class="form-check-input" type="radio" name="voteradio" id="voteradio" value="2">
  5. <button type="submit" class="btn btn-primary">Oceń</button>
  6. </form>
  7.  
  8. $('#form-vote-note').submit(function() {
  9.  
  10. var notevote = $('input:radio[name=voteradio]:checked').val();
  11. var idvote = $('input[name=idvote]').val();
  12. alert("notevote: " + notevote + " --- idvote: " + idvote);
  13.  
  14. //alert("Ocena: " + notevote + "nId vote: " + idvote);
  15. $.ajax ({
  16. url: "<?php echo base_url();?>database/save_vote_note/",
  17. type: "POST",
  18. data: {idvote: idvote, notevote: notevote, id_product: <?php echo $id_product;?>},
  19. dataType: 'json',
  20. success: function(data) {
  21.  
  22. alert("Id vote:" + data.value['idvote'] + "n voteradio: " + data.value['notevote'] + "n id_product:" + data.value['id_product'])
  23. },
  24. error: function() {
  25.  
  26. },
  27. });
  28. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement