title: jQuery ajax url parameters drupal server
body: <p>I'm trying to send inline parameters to a rest server:</p>
  
  <pre><code>  jQuery.ajax({
      type: "POST",
      url: this.apiPath + '/disp',
      dataType: 'json',
      data: 'disp_id=' +  disp_id,
      success: callback
    });
  </code></pre>
  
  <p>Is there a way to pass parameters to a jQuery ajax?
  I've tried in a lot of manners but no way...</p>
  
  <pre><code>data: {disp_id: disp_id},
  data: "{disp_id:" + '"' + disp_id + '"}',
  data: JSON.stringify({disp_id: disp_id}),
  </code></pre>
  
  <p>Always the same answer: "401 Unauthorized: Missing required argument disp_id".</p>
  
  <p>The only way I achieved this is with:</p>
  
  <pre><code>  jQuery.ajax({
      type: "POST",
      url: this.apiPath + '/disp?disp_id=' + disp_id,
      dataType: 'json',
      success: callback
    });
  </code></pre>
  
  <p><strong>Extra details:</strong></p>
  
  <p>this.apiPath = <code>http://localhost/public_html/svc/disps</code></p>
  
  <p>On the server side (drupal) I've defined the following hook_services_resources:</p>
  
  <pre><code>  $services_resources['disps']['actions']['disp'] = array(
      'help'                    =&gt; t('Retrieves the cue of objects for a given id'),
      'file'                    =&gt; array('type' =&gt; 'inc', 'module' =&gt; 'disps', 'name' =&gt; 'resources/disps.resource', ),
      'callback'                =&gt; '_disps_resource_dispositivos',
      'access callback'         =&gt; 'disps_can_view_disp',
      'access arguments'        =&gt;  array(NULL),
      'access arguments append' =&gt; FALSE,
      'args'                    =&gt; array(
        array(
          'name'          =&gt; 'disp_id',
          'type'          =&gt; 'string',
          'description'   =&gt; '',
          'source'        =&gt; array('param' =&gt; 'disp_id', ),
          'optional'      =&gt; FALSE,
        ),
      ),
    );
  </code></pre>