我下面有jQuery AJAX,
var reply_content = $('#summernote_1').code();
$.ajax({
type:"POST",
url: "<?php echo base_url();?>index.php/test/send_reply/"+<?php echo $testinfo->test_id;?>,
data: $("#test_fm").serialize()+'&file=' + file + '&test_subject=<?php echo $testinfo->testsubject;?>' +'&reply_content=' + reply_content,
});
我有文件变量是数组包含如下
array([0]=> a [1]=>b),
这是我在AJAX中传递的其他函数返回的,
我如何在AJAX中传递此信息?
最佳答案
var reply_content = $('#summernote_1').code();
$.ajax({
type:"POST",
url: "<?php echo base_url();?>index.php/test/send_reply/"+<?php echo $testinfo->test_id;?>,
data: {$("#test_fm").serialize()+'&file=' + file + '&test_subject=<?php echo $testinfo->testsubject;?>' +'&reply_content=' + reply_content},
});
您可以使用
serilizeArray()
关于javascript - jQuery ajax将form.serialize,variable和array全部作为数据发送,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30866472/