Results 1 to 3 of 3
  1.    #1  
    I'm writing an app for webos and using Ajax (XMLHttpRequest) in it. I need to do a PUT command and it's giving me problems. It actually does create a file on the server but it never puts any bytes in the file and my palm pre hangs and then restarts!

    Here's my code:
    Code:
    MyAssistant.prototype.activate = function(event)
    {
         this.req = new XMLHttpRequest();
    
         //The Handler
         this.req.onreadystatechange = this.reqHandler.bind( this );
    
         //The connection parameters, including PUT method
         this.req.open( "PUT", url + "/" + fileName, true );
    
         //Setting headers for the content I'll send
         this.req.setRequestHeader( "Content-Type", "text/plain" );
         this.req.setRequestHeader( "Content-Length", 4 );
    
         //The file's content (although I've also tried sending actual bytes)
         this.req.send( "test" );
    
         //A counter (used to test why it hangs/loops and restarts phone)
         this.counter = 0;
    };
    
    MyAssistant.prototype.reqHandler = function(response)
    {
         //If this is used, it NEVER hangs but does NOT put a file on the server
         //this.req.abort();
    
         //When this is used, it hangs until the phone restarts BUT it 
         //results in a file of length zero on the server!!
         if ( this.counter++ > 0 ) this.req.abort(); 
         //On Server: -rw-r--r--   1 ftp   ftp   0 May 18 12:11 test.txt
    };
    Last edited by 6tr6tr; 05/18/2010 at 11:36 AM.
  2.    #2  
    Any ideas?
  3.    #3  
    I added code to my orig post. (Sorry about not doing that earlier.)

Posting Permissions