Witam,
mam taki problem buduję plugin oparty o Ajax/Jquery Działa ale jak chcę podać z formularza parametry to mi ich nie przesyła.
Całego kodu pluginu nie pokazuje tylko najwarzniejsze funkcje.

Tutaj formularz z ktorego chce podac parametry:
Kod
function aad_render_admin() {
    
    ?>
    <div class="wrap">
        <h2><?php _e('Admin Ajax Demo', 'aad'); ?></h2>
            <div class="wrap">
        <form id="aad-form" action="" method="POST">
            <div>
                <p>name</p><input type="text" name="name" />
                <p>header</p><input type="text" name="header" />
<p>body</p><input type="text" name="body" />
<p>urls</p><input type="text" name="urls" />
                <input type="submit" name="aad-submit" id="aad_submit" class="button-primary" value="<?php _e('Get Results', 'aad'); ?>"/>
                <img src="<?php echo admin_url('/images/wpspin_light.gif'); ?>" class="waiting" id="aad_loading" style="display:none;"/>
            </div>
        </form>
        <div id="aad_results"></div>
    </div>
    <?php
}


Tutaj kod Jquery
Kod
jQuery(document).ready(function($) {
    $('#aad-form').submit(function() {
        $('#aad_loading').show();
        $('#aad_submit').attr('disabled', true);
        
      data = {
          action: 'aad_get_results',
          aad_nonce: aad_vars.aad_nonce
      };

         $.post(ajaxurl, data, function (response) {
            $('#aad_results').html(response);
            $('#aad_loading').hide();
            $('#aad_submit').attr('disabled', false);
        });    
        
        return false;
    });
});


Tutaj akcja funkcji która działa ale nie wyswietla parametrow sam insert działa ale nie zapełnia rekordow z formularza:
Kod
function aad_process_ajax() {
    global $wpdb;

    echo $name = $_POST['name'];
    $header = $_POST['header'];
    $body = $_POST['body'];
    $urls = $_POST['urls'];
    echo 'xxxx';

        $wpdb->insert(  
        'wp_myprojects',
            array(    'name' => $name,
                    'header' => $header,
                    'body' => $body,
                    'urls' => $urls,
                    ),
            array(    '%s',
                    '%s',
                    '%s',
                    '%s'
                    )
        );
    
    $wpdb->show_errors();
    /*EVRY PROCESS AJAX MUST DIE!!!!*/
    die();
    /*EVRY PROCESS AJAX MUST DIE!!!!*/
}
add_action('wp_ajax_aad_get_results','aad_process_ajax');


Wiecie dlaczego? Problem jest wordpressa czy jquery?

Edit:
Dzowiedziałem się:
W jquery
Kod
  data = {
      action: 'aad_get_results',
      aad_nonce: aad_vars.aad_nonce,
      form_data: $('#aad-form').serialize()
  };


I w
Kod
function aad_process_ajax() {

  parse_str($_POST['form_data'], $form_data);
  $name = isset($form_data['name']) ? : '';
  $header = isset($form_data['header']) ? : '';
  $body = isset($form_data['body']) ? : '';
  $urls = isset($form_data['urls']) ? : '';

  // the rest of your code here

}