NOTE: This is not a module, it's a simple javascript library to interact with services endpoints. It has no dependencies, and is really lightweight.
This can be used to integrate your Drupal site with a phonegap (Apache cordova) app.
Usage
var drupal = new drupalService();
drupal.url = 'http://example.com/endpoint';
drupal.method = 'node.json';
drupal.get();
That would give you the front page in json.
To log in:
var drupal = new drupalService();
// Set URL to your services endpoint.
drupal.url = 'http://example.com/endpoint';
// Set method to a services resource.
drupal.method = 'user/login.json';
// Set data to what you want to send (if anything).
// This example is sending username and password for logging in.
drupal.data = {
'username': 'admin',
'password': 'admin'
}
// Set callback to do something when you are done.
drupal.callback = function(data) {
console.log(data);
}
// Optionally set drupal.error to be an error callback. Syntax as above.
// In the end, either post or get (depending on what you are doing). Let's post this.
drupal.post();
A more advanced example with posting images in nodes:
var file = new drupalService();
file.url = 'http://dcoslo/endpoint';
// Data object for a file entity.
file.data = {