2016-10-17 7 views
0

Hi Ich habe Probleme beim Einfügen von TextArea für AJAX Bitte helfen Sie mir herauszufinden, was falsch ist. DankeWie man AJAX TextArea einfügt

 $('#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-Funktionen:

 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

r u den Wert in 'print_r bekommen ($ _ POST)' in PHP? plz chk – devpro

+0

müssen Sie definieren als: global $ wpdb nach Überprüfung. –

+0

hi devpro ja es gibt Wert – coolshox

Antwort

0

Ich wechsle gerade dieses

$('#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){ 
     } 
    }); 
    }); 
Verwandte Themen