Getting radio button value and sending through ajax to php

前端 未结 3 748
不知归路
不知归路 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:15

      $optionID = "="+optionID;
    

    I don't quite understand what you are trying to do here o.O, in javascript you don't define your variables using $.

    data: { optionID : option}
    

    using it like this should work. You would retrieve it like this in PHP:

    $option_value=$_POST['optionID'];
    

提交回复
热议问题