What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Solved] XMLHTTP post

[Solved] XMLHTTP post
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: XMLHTTP post
Well, this is just because onreadystatechange actually gets called multiple times by the object. The XmlHttp object will tell the script what's it doing, so you can (eventually) make some sort of "status bar" for your script, but I don't think it's needed to use a GUI for this and thus it's not important. Therefore, you only need to know when it's done, and that's where readyState == 4 is for.

A reference of the readyState property explains why you get this:
quote:
Originally posted by DevGuru XmlHttp object reference
The readyState property indicates the current state of the request. It returns a 4-byte integer.

This property is read-only and has the following defined values

    * UNINITIALIZED(0)
      The object has been created, but has not been initialized (the open method has not been called).
    * LOADING(1)
      The object has been created but the send method has not been called.
    * LOADED(2)
      The send method has been called and the status and headers are available, but the response is not.
    * INTERACTIVE(3)
      some data has been received. You can get the partial results using the responseBody and the responseText properties.
    * COMPLETED(4)
      All the data has been received, and is available.
If you compare this to your debug, you'll understand what's happening:
quote:
Function called: OnEvent_Signin
Post failed! - Uninitialized, you didn't call open() yet.
Posted info-> user=decosemail@email.com&status=online
Post failed! - Loading, you didn't call send() yet.
Post failed! - Loaded, the response is not available yet.
Post failed! - Interactive, some data has already been retrieved.
Received info-> heremail@hotmail.com offline - Completed, so you're function takes over as you can see.
Parsing...
Parse-> heremail@hotmail.com offline

My suggestion: leave out the else block. If you want to check for errors, use this instead:
code:
        if(xmlhttp.readyState === 4) {
            if(xmlhttp.status === 200) {
               Debug.Trace('Received info-> ' + xmlhttp.responseText);
               ParseResponse(xmlhttp.responseText);
            } else Debug.Trace('Post failed!');
        }

This post was edited on 08-29-2007 at 04:41 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
08-29-2007 04:38 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Solved] XMLHTTP post - by Deco on 08-28-2007 at 09:12 PM
RE: XMLHTTP post - by roflmao456 on 08-29-2007 at 12:20 AM
RE: RE: XMLHTTP post - by davidpolitis on 08-29-2007 at 10:15 AM
RE: XMLHTTP post - by Deco on 08-29-2007 at 01:16 AM
RE: XMLHTTP post - by -dt- on 08-29-2007 at 01:54 AM
RE: XMLHTTP post - by Deco on 08-29-2007 at 03:08 PM
RE: XMLHTTP post - by matty on 08-29-2007 at 03:39 PM
RE: XMLHTTP post - by Deco on 08-29-2007 at 04:16 PM
RE: XMLHTTP post - by Matti on 08-29-2007 at 04:38 PM
RE: XMLHTTP post - by Deco on 08-29-2007 at 04:43 PM
RE: [Solved] XMLHTTP post - by roflmao456 on 08-29-2007 at 05:33 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On