What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » AJAX isn't working

AJAX isn't working
Author: Message:
The-Phantom
New Member
*


Posts: 10
Joined: Aug 2010
O.P. RE: AJAX isn't working
Okay. I've made a simple script to demonstrate it. Here's the only JS file:

var xhr;
var ready;
function OnEvent_ChatWndSendMessage(Wnd, Message)
{
    if(Message.substr(0, 10) != "/ajax-test")
        return "";
    Debug.Trace("Retrieving " + Message.substr(11));
    var Iter = 0;
    xhr = new ActiveXObject("Microsoft.XMLHTTP");
    xhr.open("GET", encodeURI(Message.substr(11)), true);
    xhr.onreadystatechange = function()
    {
        if(xhr.readyState == 4)
            ready = true;
    };
    ready = false;
    xhr.send();
    while(!ready)
        // If I don't check for this here, it just hangs up because ready is always false and this becomes an infinite loop
        if(Iter++ > 10000000)
        {
            Debug.Trace("Error.");
            return "";
        }
    Debug.Trace(xhr.responseText);
    return "";
}

With the appropriate ScriptInfo.xml, I've tested it with several URLs, and here are the results:

Function called: OnEvent_ChatWndSendMessage
Retrieving http://example.com/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
  <META http-equiv="Content-Type" content="text/html; charset=utf-8">
  <TITLE>Example Web Page</TITLE>
</HEAD>
<body> 
<p>You have reached this web page by typing &quot;example.com&quot;,
&quot;example.net&quot;,&quot;example.org&quot
  or &quot;example.edu&quot; into your web browser.</p>
<p>These domain names are reserved for use in documentation and are not available
  for registration. See <a href="http://www.rfc-editor.org/rfc/rfc2606.txt">RFC
  2606</a>, Section 3.</p>
</BODY>
</HTML>


Function called: OnEvent_ChatWndSendMessage
Retrieving http://www.example.com/
Error.
Function called: OnEvent_ChatWndSendMessage
Retrieving http://www.msgplus.net/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta name="norton-safeweb-site-verification"
...
</div>

</body>
</html>

Function called: OnEvent_ChatWndSendMessage
Retrieving http://www.google.com/
Error.
08-29-2010 07:09 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
AJAX isn't working - by The-Phantom on 08-28-2010 at 01:33 PM
RE: AJAX isn't working - by V@no on 08-29-2010 at 05:31 AM
RE: AJAX isn't working - by The-Phantom on 08-29-2010 at 07:09 AM
RE: AJAX isn't working - by Matti on 08-29-2010 at 07:10 PM
RE: AJAX isn't working - by The-Phantom on 08-29-2010 at 07:57 PM
RE: AJAX isn't working - by CookieRevised on 08-29-2010 at 08:24 PM
RE: AJAX isn't working - by Matti on 08-29-2010 at 08:43 PM
RE: AJAX isn't working - by The-Phantom on 08-30-2010 at 06:48 AM
RE: AJAX isn't working - by CookieRevised on 08-30-2010 at 08:31 AM
RE: RE: AJAX isn't working - by The-Phantom on 08-30-2010 at 08:40 AM
RE: RE: RE: AJAX isn't working - by CookieRevised on 08-30-2010 at 09:01 AM
RE: RE: RE: RE: AJAX isn't working - by The-Phantom on 08-30-2010 at 09:22 AM
RE: AJAX isn't working - by Eljay on 08-30-2010 at 09:41 AM
RE: AJAX isn't working - by CookieRevised on 08-30-2010 at 10:12 AM
RE: AJAX isn't working - by Eljay on 08-30-2010 at 10:35 AM


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