var JsonClientPatientSearch = Titanium.Network.createHTTPClient();
// API Url to call
var url = GetAPIUrl() + "PatientSearch";
JsonClientPatientSearch.open("POST", url);
//setting Request Header
JsonClientPatientSearch.setRequestHeader("Content-type", "application/json");
JsonClientPatientSearch.send(PatientSearch(PatientSearchCriteria,Credentials,Header));
JsonClientPatientSearch.onload = function(){
};
JsonClientPatientSearch.onerror = function(e){
};
I have a lot of JSON calls in my project, is it possible i can write a class and use its instance to make the JSON Call… just passing the parameters…
You can create instances of objects and reuse them. Your code would look something like this:
You’ll need to tweak this according to how this needs to work with your other global objects. But hopefully this should send you in the right direction.