Hi I'm having trouble in inserting textarea for ajax PLease help me to figure out whats wrong. Thank you
$('#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 functions:
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,
)
);
}
I just change this
$('#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){
}
});
});