Skip to content

Instantly share code, notes, and snippets.

@mishudark
Created January 18, 2011 23:56
Show Gist options
  • Select an option

  • Save mishudark/785411 to your computer and use it in GitHub Desktop.

Select an option

Save mishudark/785411 to your computer and use it in GitHub Desktop.
drupal services over json
var url = 'http://drupalcon.tut2tech.com/services/json';
var datos = {method: 'user.get',uid:1};
var data = {};
var xhr = Titanium.Network.createHTTPClient();
xhr.onload = function(){
data = JSON.parse(this.responseText);
Ti.API.info(data);
}
xhr.onerror = function(e){
Ti.API.info(e.error);
Ti.API.info('xhr error');
}
xhr.open('POST',url);
xhr.send({data: JSON.stringify(datos)});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment