XHR null response

You must Login before you can answer or comment on any questions.


I'm sending a JSON request to a Drupal web service that normally works via javascript in the browser. Yet when I use Titanium on the iPhone I receive a null response.

I've pointed my iPhone/Titanium request to a small script that intercepts my POST data so I can analyse exactly what the server is seeing and it is showing exactly the same as the web version produces.

Which is:

    [method] => system.connect
So the output to the server seems valid - I'm just not getting back what the web version receives.

my Titanium/JS code looks like the following:

var xhr = Titanium.Network.createHTTPClient();
xhr.onload = function()
xhr.onerror = function()
    alert('POST error');
xhr.setRequestHeader("Content-Type", "application/json");"POST","http://myserver.tld/services/json");
Many Thanks,


2 Answers

try changing all of the "this" to "xhr"

xhr.onload = function()

I'm happy to report that it was Drupal's fault not Titanium.

Some JSON encoding issues in json_server-2.0-alpha2

— answered 5 years ago by Steve Liddell
answer permalink
  • and I must thank 'aw2xcd' on titanium irc for helping me isolate the issue. cheers!

    — commented 5 years ago by Steve Liddell

  • Steve-

    I am encountering the exact same problem. Is there any chance you can share how you got around the issues in json_server-2.0-alpha2? I am using that, Services 2 and PHP 5.2.9.

    — commented 4 years ago by Ari Edelson

Your Answer

Think you can help? Login to answer this question!