0

I'm on the admin side of wordpress and therefore am using ajaxurl. Is there any way I can pass information through different keys. For example, like "extra" below...

Ajax That's Sending The Data

jQuery(document).ready(function($) {
      var my_data = {
                action: 'arrow_handler',
                function to use
                move_id: user_id,
                arrow_status: 'down'
     };
    $.post(ajaxurl, data, function(response) {
        alert('Got this from the server: ' + response);
    });

*I noticed that if you remove "($_POST('arrow_status') == 'up' || $_POST('arrow_status') == 'down')" from below it ignores the 'arrow_status' which hasn't seem to have been sent*

Conditional Statement That's Processing The Sent Data

if (isset($_POST['move_id']) && !empty($_POST['move_id']) &&
($_POST('arrow_status') == 'up' || $_POST('arrow_status') == 'down') && $checkifrows > 0) {                     $lastuser = $wpdb->get_var("SELECT MAX(ordr) AS ordr FROM $table");
//fetch the results to see what the users order is
$userorder = $wpdb->query($wpdb->prepare('SELECT ordr FROM ' . $table . ' WHERE id = %d      LIMIT 1', $_POST['move_id']));
            }
            die();
}
  • You are passing information through different "keys" if I understand the question. Just do more of the same. – s_ha_dum Aug 30 '13 at 23:41
  • I tried that but I could only read the first key, "whatever". Should that be the case? Thanks for helping. – Andre Yonadam Aug 30 '13 at 23:45
  • How are you trying to "read" the keys? Post that code. – s_ha_dum Aug 30 '13 at 23:46
  • This is my code with my key names. – Andre Yonadam Aug 30 '13 at 23:51
  • ('if (isset($_POST['move_id']) && !empty($_POST['move_id']) && ($_POST('arrow_status') == 'up' || $_POST('arrow_status') == 'down') && $checkifrows > 0)') – Andre Yonadam Aug 30 '13 at 23:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.