0
我試圖用drupalgap將圖像從android模擬器保存到drupal網站,但我無法做到這一點,下面是我寫的保存數據到drupal網站的ajax調用。使用drupalgap將圖像保存到drupal網站
我的AJAX調用
$.ajax({
url: "http://192.168.1.146/drunew/?q=my_services/node.json",
type: 'post',
data: 'node[type]=drupalgap&node[title]=' + encodeURIComponent(title) + '&node[language]=und&node[body][und][0][value]=' + encodeURIComponent(body) + '&node[files][field_filef_und_0]=' + encodeURIComponent(filef),
dataType: 'json',
beforeSend: function (request) {
request.setRequestHeader("X-CSRF-Token", token);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert('page_node_create_submit - failed to login');
console.log(JSON.stringify(XMLHttpRequest));
console.log(JSON.stringify(textStatus));
console.log(JSON.stringify(errorThrown));
},
success: function (data) {
$.mobile.changePage("main.html", "slideup");
}
});
但上面的代碼是不工作的文件中的字段,然後做一些[R & d我知道,首先我們必須得到裂後,然後將其保存。
下面是創建圖像的fid後的回覆。
{"fid":"47","uri":"http://192.168.1.146/drunew/my_services/file/47"}
這裏我懷疑是如何集成在我上面的Ajax調用保存的圖像在Drupal站點的回覆。
任何幫助,感謝..