phonegap save xml file local



How can i save files local on the device with phonegap? i make an ajax call to an external address but i want to make 2 ajax call, one to save the xml file and on success i want to do another ajax call but to the local file i just saved? Did u understand?





$.ajax({
type: 'GET',
url: this.settings.dataLocation + (this.settings.dataType === 'jsonp' ? (this.settings.dataLocation.match(/\?/) ? '&' : '?') + 'callback=?' : ''),
// Passing the lat, lng, and address with the AJAX request so they can optionally be used by back-end languages
data: {
'origLat': lat,
'origLng': long,
'origAddress': address
},
cache: true,
dataType: dataTypeRead,
jsonpCallback: (this.settings.dataType === 'jsonp' ? this.settings.callbackJsonp : null)
}).done(function(p) {
d.resolve(p);

// Loading remove
if (_this.settings.loading === true) {
$('#loader').hide();
$('.wrapper').show();
}
$('h3.search-for').text(address);
localStorage.setItem('CurrentAddress', address);

}).fail(d.reject);
return d.promise();
},


Cheers!


No comments:

Post a Comment