Drupal 7 Ajax GET - Error 400 (Hook_menu) I am trying to send an array back to Drupal to save in a database table. I'm getting an error 400 though when inspecting in the console and the url seems correct:


  GET http://localhost/audiophreak/callback/%?[1,2,3,4,5,6,45,46,47] 400
  (Bad Request)


Here is my hook_menu:

/**
* Implementation of hook_menu().
*/
function my_db_module_menu() {
  $items['callback/%?'] = array(
    'title' =&gt; 'My callback',
    'description' =&gt; 'Desc',
    'page callback' =&gt; 'mymodule_getinfo',
    'type' =&gt; MENU_CALLBACK,
    'access arguments' =&gt; array('access content'),
    'page arguments' =&gt; array(1),
  );
  return $items;
}


Here is my callback:

/**
 * My callback
 */
function mymodule_getinfo($data) {

echo drupal_json_decode($data);


  // //Parse the data and input it into the database
  // $result = db_insert('my_db')
  // -&gt;fields(array(
    // 'nid' =&gt; $data-&gt;node,
    // 'uid' =&gt; $data-&gt;user,
    // 'progress' =&gt; $data-&gt;progress,
  // ))
  // -&gt;execute();
}


And here is my AJAX 

//Data
    var post = plnzVideoTracker.progress


    //Begin Ajax
    $.ajax({
          url: '/audiophreak/callback/%',
          contentType: "application/json; charset=utf-8",
          type: 'GET',
          dataType: 'json',
          data: JSON.stringify(post),
          success: function(data) {
            if(data == "success")
            {
            $('.status').attr("innerHTML","&lt;font color='green'&gt;Name submitted successfully!&lt;/font&gt;");
            }
            else
            {
              $('.status').attr("innerHTML","&lt;font color='red'&gt;Name submit failed!&lt;/font&gt;");
            }
            },
            beforeSend: function() {
              $(document).ready(function () {
              $('.status').attr("innerHTML","Loading....");
            });
            },
            'error': function(data) {
              $(document).ready(function () {
              $('.status').attr("innerHTML","ERROR OCCURRED!");
            });
          }
     });


plnzVideoTracker.progress is an array inside of an object literal if that has anything to do with it?
The % symbol is type of placeholder in hook_menu item. You can read more about it here: https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_menu/7#sec_path_wildcards.

For you example I suggest to use the following:

function my_db_module_menu() {
  $items['callback'] = array(
    'title' =&gt; 'My callback',
    'description' =&gt; 'Desc',
    'page callback' =&gt; 'mymodule_getinfo',
    'type' =&gt; MENU_CALLBACK,
    'access arguments' =&gt; array('access content'),
  );

  return $items;
}


Simple path  - callback.

And use the following AJAX:

$.ajax({
  url: '/callback',
  type: 'POST',
  dataType: 'json',
  data: {data: post},
  ...


By this way, you can access the data in your webhook more simply:

/**
 * My callback
 */
function mymodule_getinfo() {
  $data = !empty($_POST['data']) ? $_POST['data'] : array();

  // do what you want...
}