Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/373.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用PhoneGap进行同步_Javascript_Android_Html_Jquery Mobile_Cordova - Fatal编程技术网

Javascript 使用PhoneGap进行同步

Javascript 使用PhoneGap进行同步,javascript,android,html,jquery-mobile,cordova,Javascript,Android,Html,Jquery Mobile,Cordova,我使用请求从服务器获取所有数据。但就我而言,我修改了数据,因此我需要使用JavaScript、jQuery和Ajax将修改后的数据发送到服务器 这样做的示例是什么?使用以下方法: Ext.Ajax.request({ url : serverApiUrl, method : "POST", scriptTag : true, headers : {'Content-Type': 'application/json'},

我使用请求从服务器获取所有数据。但就我而言,我修改了数据,因此我需要使用JavaScript、jQuery和Ajax将修改后的数据发送到服务器

这样做的示例是什么?

使用以下方法:

Ext.Ajax.request({ 
    url         : serverApiUrl,
    method      : "POST",
    scriptTag   : true,
    headers     : {'Content-Type': 'application/json'},
    scope       : this,
    jsonData    : yourModifiedJsondata, 
    success     : successFN,
    failure     : failureFN
});

function onError(jqXHR, textStatus, errorThrown) {
   // Or use alerts if you can't see your log
   console.log("status: " + textStatus);
   console.log("errorThrown: " + errorThrown);
   // can't remember if this works:
   console.log(jqXHR.statusText);
}

console.log('ajaxing!'); 
$.ajax({ 
   type: 'post', 
   url: 'PRIVATE_URL', 
   data: {test:'asdf'}, 
   dataType: 'json', 
   success: function(data){ 
      console.log('done'); 
   },
   error: onError
});

谢谢,没有使用extjs的情况下,是否有任何流程可以满足同样的要求。因为我使用的是phonegap。非常感谢。新年快乐