Multiple Requests with httpClient (appcelerator)
With appcelerator, I am attempting to send a picture with the twitp开发者_JAVA百科ic demo, I have created 2 text fields and when they are filled in I want to upload the image and those fields to twitpic.
The problem with the app, is after I do it successfully the first time, (without closing the app) the second time doesn't send.
I need to somehow reset the httpClient open so it will re-open it.
Here is my code gist code
You could add xhr.abort() to the end of you updateSuccess function to close the open connection first
function networkUpdateSuccess() {
alert('Success Uploaded',Ti.App.globalImage);
win.rightNavButton = null;
Ti.App.globalImage = null;
whatText.value = '';
whereText.value = '';
actInd.hide();
upload.hide();
previewImage.image = '../images/upload_image.png';
xhr.abort();
}
I had the same problem, and resolved to creating a new HttpClient every time I make a request.
精彩评论