Jquery 将多个图像上载到api-phonegap

Jquery 将多个图像上载到api-phonegap,jquery,cordova,Jquery,Cordova,我在一个phonegap项目中,我有一个包含一些内容的页面要发布到服务器。我已将文本内容发布到服务器,如下所示“ 这一切都很好,但我想上传一些从设备上拍摄的图像,我不知道如何上传多个图像,因为我在将文件上传到api方面没有太多经验。等待您的帮助。谢谢。使用phonegap上传图像 :感谢您的回复。.图片上传成功后,我应该什么时候上传我的文本内容?或者viceversa?viceversa,但更好的是在文本内容发布成功后。在您的提交按钮上,需要添加两次文件传输呼叫。我已经完成了五张图片检查此项确定

我在一个phonegap项目中,我有一个包含一些内容的页面要发布到服务器。我已将文本内容发布到服务器,如下所示“

这一切都很好,但我想上传一些从设备上拍摄的图像,我不知道如何上传多个图像,因为我在将文件上传到api方面没有太多经验。等待您的帮助。谢谢。

使用phonegap上传图像
:感谢您的回复。.图片上传成功后,我应该什么时候上传我的文本内容?或者viceversa?viceversa,但更好的是在文本内容发布成功后。在您的提交按钮上,需要添加两次文件传输呼叫。我已经完成了五张图片检查此项确定。我将发布您另一个问题的答案。
$.ajax({
                                url:"http://xxxx.xxx.xx/mobapp/api/save-data",
                                type:"POST",
                                crossDomain: true,
                                dataType:"json",
                                data: {pliid: document.pliform.pliid.value,idate:document.pliform.date.value,
                                    snum:document.pliform.street_no.value,
                                    sname:document.pliform.street_name.value,state:document.pliform.state.value,
                                    pcode:document.pliform.PostCode.value,
                                    suburb:document.pliform.Suburb.value,
                                            productlist:pl},
                                success: function(data) {
                                     alert("success");
                                     console.log(JSON.stringify(data));

                                },
                                error: function(jqXHR,  textStatus,  errorThrown,data) {
                                     console.log("readyState: " + jqXHR.readyState);
                                }
 function uploadImage(){
       //Using Camera
       navigator.camera.getPicture(uploadPhoto, onFailcapturePhoto, { quality: 50,destinationType: Camera.DestinationType.FILE_URI }); 
        //Using library            
       navigator.camera.getPicture(uploadPhoto, onFailcapturePhoto, { quality: 50,destinationType: navigator.camera.DestinationType.FILE_URI, sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY});    
 }

  function onFailcapturePhoto(message) {    
     console.log("Message = " + message);
   }

 function uploadPhoto(imageURI) {
    var imagefile = imageURI; 
     $('#vImage').attr('src', imagefile);
/* Image Upload Start */
var ft = new FileTransfer();                     
var options = new FileUploadOptions();                      
options.fileKey="vImage1";                      
options.fileName=imagefile.substr(imagefile.lastIndexOf('/')+1);
options.mimeType="image/jpeg";  
var params = new Object();
params.value1 = "test";
params.value2 = "param";                       
options.params = params;
options.chunkedMode = false;                       
ft.upload(imagefile, your_service_url, win, fail, options);   
 }

 function win(r) {
     console.log("Code = " + r.responseCode);
     console.log("Response = " + r.response);
     //alert($.parseJSON(r.response))    
 }

 function fail(error) {
    console.log("Response = " +  error.code);
 }