Desidero registrare i dati JSON utilizzando la richiesta HTTP. Ho letto l'ufficiale docs e sto lavorando in base a loro. Sto usando il seguente codice:Problema con dati POST JSON Titanium
var xhrpost = Ti.Network.createHTTPClient();
xhrpost.onload = function(){
activityIndicator.hide();
alert('Posted successfully');
alert(JSON.stringify(this.responseText));
}
var posturl = 'http://qudova.com/api.php';
xhrpost.open('POST', posturl);
xhrpost.setRequestHeader("Content-Type", "application/json");
xhrpost.setRequestHeader('charset','utf-8');
var params = {
ProjectID : picked_prj,
RoleID : picked_rol,
FirstName: first.value,
LastName: last.value,
Phone: phone.value,
Email: email.value,
City: city.value,
State: stat_drp.getSelectedRow(0).title,
Zip: zip.value,
Notes: notes.value,
};
xhrpost.send(params);
Se questo è il modo corretto di pubblicare i dati JSON. Come dovrei controllare che i dati vengano pubblicati ?? L'url contiene i dati inviati ??
Si ottiene null nel seguente avviso che ho aggiunto nell'evento onload.
Sto lavorando su Windows 7, Test su Android 4.2.2 .... Grazie in anticipo.
No, questo mi dà solo un errore: oggetto non definito. –