PUT HTTPClient doesn't seem to be working

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

I have tested PUT using the Poster plugin for firefox and it works as expected but when I run a function containing the following nothing happens not even a stauscode so am I doing something wrong?

var url = 'http://www.example.com/api/update/' + id;
    var xhr = Titanium.Network.createHTTPClient({timeout: timeout});
    xhr.onload = function() {
        if(xhr.status == 200) {
            var response = xhr.responseText;
            var data = JSON.parse(response);
            Ti.API.info(data);
            onSuccess(data, xhr.status);
        }
    }
    xhr.open("PUT", url);
    xhr.send();

— asked 12 months ago by Marcus Williams
4 Comments
  • can you put the onerror code in to capture the reason or failure ?...

    — commented 12 months ago by Trevor Ward

  • Which SDK version and platform? (You should always provide this info when asking for help ;) )

    — commented 12 months ago by Kosso .

  • Sorry is IOS and SDK 2.1

    I have just included onerror as

    xhr.onerror = function () { 
        error(xhr, xhr.status); 
      };
    and I don't get an error

    — commented 12 months ago by Marcus Williams

  • Show 1 more comment

Your Answer

This question has been locked and cannot accept new answers.