0

这就是我想要得到的response14.php?questionID=1&question=yes&approved=1

这是我目前得到的response14.php?questionID=[object%20Object]&question=undefined&approved=1

这是js文件:

$(document).ready(function(){
    $(".save_btn").on('click', function() {
         var check = $("input[name=no]").is(":checked")?2:1;
         var questionID = $("textarea[id=questionID]").val();
         var question = $("textarea[value=question]").val();
        location = "response14.php?questionID=" +questionID + "&question=" +question + "&approved=" +check;

这是呈现的html:

 <td style='border:1px white; padding: 5; margin: 5;'><div id='wrap'>
<textarea cols='85' rows='2' id='3792' class='response textbox'>Hello C!!

Where can I send you fan mail? :)
I want your autograph and I'm from the Philippines :)

God bless Cooper!</textarea>
    YES: <input type='checkbox' name='yes' value='yes'> &nbsp;&nbsp;&nbsp;
    NO: <input type='checkbox' name='no' value='no'>    </div></td></tr><tr style='border:1px white; background-color:lightgrey; color:black; padding: 5; margin: 5;'><td style='border:1px white; vertical-align:top; padding: 5; margin: 5;'>Gavin Casalegno</td>
                      <td style='border:1px white; padding: 5; margin: 5;'><div id='wrap'>
<textarea cols='85' rows='2' id='3793' class='response textbox'>What is your religion?
Do you believe in God?
How much you measure height?</textarea>
    YES: <input type='checkbox' name='yes' value='yes'> &nbsp;&nbsp;&nbsp;
    NO: <input type='checkbox' name='no' value='no'>    </div></td></tr></tbody></table><button type='button' class='save_btn' style='align:right'>Save All</button><br>

有想法该怎么解决这个吗???

4

1 回答 1

1

尝试更换

var questionID = $("textarea[id=questionID]").val();
var question = $("textarea[value=question]").val();

var questionID = $(textarea).attr('id');
var question = $(textarea).val();
于 2013-09-19T15:58:45.187 回答