您好我在为ajax PLease插入textarea时遇到了麻烦,这有助于我弄清楚什么是错误的。谢谢
$('#submit').click(function(){
var message_options = $('#message_options').val();
$.ajax({
type: "post",
url: ajax_params.ajax_url,
data: {"action": "data",
"message_options":message_options,
},
success: function(data){
}
});
});
PHP函数:
function data(){
global $wpdb;
$message_options = $_POST['message_options'];
$result2 = $wpdb->insert( $table_client_event_details ,
array(
'contact_person_id'=>$wpdb->insert_id,
'message_options'=> $message_options,
)
);
}
答案 0 :(得分:0)
我只是改变了这个
$('#submit').click(function(){
var message_options = $('textarea').val(); // I change the element id to textarea. I dont know why if I use ID does not working. Thank you
$.ajax({
type: "post",
url: ajax_params.ajax_url,
data: {"action": "data",
"message_options":message_options,
},
success: function(data){
}
});
});