我在第二次通过ajax提交表单时未定义。
jQuery(function($){
var site_url = '<?php echo site_url('front/submit_quote'); ?>';
$('button.showme').click(function(ev){
var uid = $(this).data('id');
$('.modal-body').attr("id","ta"+uid);
var neil = $('#ta'+uid+' textarea').val(uid);
$('#ta'+uid+' textarea').attr("id","taval"+uid);
$('.save-data').click( function (e) {
$('.modal').modal('hide');
var msg = $('#ta'+uid+' textarea').val();
$.ajax({
url: site_url,
type: 'POST',
data: 'id='+uid+'&message='+msg,
success: function(data){
console.log(data);
return false;
}
});
});
});
});
控制台结果:
Array (
[id] => 35
[message] => 35fffffffffff
)
Array (
[id] => 35
[message] => undefined
)
Array (
[id] => 23
[message] => 23dfsdsdfsdfsdfsdfsdf
)