Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

http request, mootools, POST/GET sending variables problem on titanium

Hello, I have a web application working flawlessly but i there are some issues on the porting to win32 using Titanium. The web app is based on PHP, Mootools and JSON. When I use Titanium I have problems sending variables through mootools' Requests: PHP actually responds to the request but no variables are passed and in the end most of the php code is useless… why does this happens? also, I tried with Titanium.Network.createHTTPClient() instead of mootools' Request. This is the log:

scheme is not supported by HTTPClient

here is my code

var params=/*some params*/
var THEurl=/*<xxx>.php*/
var xhr = Titanium.Network.createHTTPClient();
xhr.onload=function(){
    xhr.open('POST',THEurl);
}
xhr.setRequestHeader('Content-Type', 'text/html; charset=utf-8');
xhr.send(params);
— asked November 25th 2010 by pierpaolo mascia
  • httprequest
  • post
  • titanium.network
  • win32
0 Comments

2 Answers

  • first problem is that

    xhr.open('POST',THEurl);
    

    should not be inside the onload function

    look at kitchen sink example

    — answered November 25th 2010 by Aaron Saunders
    permalink
    1 Comment
    • thanks Aaron.
      i made a mistake posting the code. the

      xhr.open('POST',THEurl);
      

      is atually after the onload function.
      i'm realizing the issue is THEurl. i'm trying to call a link which is not located in a server. i mean, my url is inside my localhost but i can't reach it. i guess i should define the url this way

      http://localhost:<PORT>/url
      

      but i don't know if this is correct, and i don't even know the port.
      i'm new with the titanium architecture, so any information is appreciated.
      by the way, do any of you knows why my request with mootools doesn't sends vars?

      — commented November 25th 2010 by pierpaolo mascia
  • hello i'm occured the same problemes i can't access my database with (http://localhost:8888/post_register.php")
    post_register.php is locat in the www folder of the wamp server.
    can help me right now please???

    — answered August 2nd 2011 by Rajaa Samaha
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.