Getting radio button value and sending through ajax to php

前端 未结 3 765
不知归路
不知归路 2021-01-01 02:50

I have a poll on my website which displays radio buttons next to each answer. When the user selects an option and submits, im running a a php script via ajax to insert the v

3条回答
  •  离开以前
    2021-01-01 03:26

    $("#submit_vote").click(function(e){ 
    
        $.ajax( {
          type: "POST",
          url: "ajax_submit_vote.php",
          data: $('#poll_form').serialize(),
          success: function( response ) {}
        });
    
    });
    

    You should then have the POST variable "poll_option" accessible in your PHP script.

提交回复
热议问题