私は残りのサーバーにインラインパラメータを送信しようとしている:jQueryのAjaxのURLパラメータDrupalのサーバー
jQuery.ajax({
type: "POST",
url: this.apiPath + '/disp',
dataType: 'json',
data: 'disp_id=' + disp_id,
success: callback
});
は、jQueryのAJAXにパラメータを渡す方法はありますか? 私は...マナーの多くが、決して試みた常に同じ答え
data: {disp_id: disp_id},
data: "{disp_id:" + '"' + disp_id + '"}',
data: JSON.stringify({disp_id: disp_id}),
:「401権限:行方不明に必要な引数disp_id」。
jQuery.ajax({
type: "POST",
url: this.apiPath + '/disp?disp_id=' + disp_id,
dataType: 'json',
success: callback
});
エクストラ詳細:私が定義したサーバー側で
this.apiPath = http://localhost/public_html/svc/disps
(drupalの)
私はこれを達成する唯一の方法はですhook_services_resourcesに続いて:
$services_resources['disps']['actions']['disp'] = array(
'help' => t('Retrieves the cue of objects for a given id'),
'file' => array('type' => 'inc', 'module' => 'disps', 'name' => 'resources/disps.resource',),
'callback' => '_disps_resource_dispositivos',
'access callback' => 'disps_can_view_disp',
'access arguments' => array(NULL),
'access arguments append' => FALSE,
'args' => array(
array(
'name' => 'disp_id',
'type' => 'string',
'description' => '',
'source' => array('param' => 'disp_id',),
'optional' => FALSE,
),
),
);
RESTサーバーの場合は、RESTfulなURLを使用することをおすすめします – Madbreaks
素晴らしい!はい、それは私に考えさせました...私はGETで可能かどうかを確認しようとしています – Miquel