0
new Ajax.Request('http://habbo.com.br/client', {
    onComplete: function (x) {
        var sso1 = x.responseText.match(/"sso.ticket" : "(.+)"/)[0].split('"')[3];
    }
});

When I use this code the following error appears:

Uncaught ReferenceError: Ajax is not defined (anonymous function)

and I don't understand why! Does anyone know the problem?

Qantas 94 Heavy
  • 15,750
  • 31
  • 68
  • 83
user3133630
  • 3
  • 1
  • 2
  • 5

1 Answers1

0

You have to request ajax:

try {
    var ajaxRequest; // The variable that makes Ajax possible!

    try {
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } catch (e) {
        // Internet Explorer Browsers
        try {
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                // Something went wrong
                alert("Your browser broke!");
                return false;
            }
        }
new Ajax.Request('http://habbo.com.br/client', {
                onComplete: function (x) {
                    var sso1 = x.responseText.match(/"sso.ticket" : "(.+)"/)[0].split('"')[3];
                }
            });
    }
        } catch (e) {
            alert("This won't show up, so no error!");
        }
Cilan
  • 13,101
  • 3
  • 34
  • 51
  • How i use this code in a page with a Iframe of the site http://www.habbo.com.br/me Because this code works perfectly if i use in http://habbo.com.br/me but i use in another site with a Iframe of this site doesn't work – user3133630 Dec 25 '13 at 03:33
  • @user3133630 Read http://stackoverflow.com/questions/333532/cross-site-ajax-requests – Cilan Dec 25 '13 at 03:49
  • Man od Snow i read but i can't understand how i apply that on my code :c – user3133630 Dec 25 '13 at 05:26
  • @user3133630 read http://en.wikipedia.org/wiki/JSONP '***JSONP or "JSON with padding" is a communication technique used in JavaScript programs running in web browsers to request data from a server in a different domain, something prohibited by typical web browsers because of the same origin policy.***' So put this at the beginning of your `body` tag: `` That might not be *exactly* correct, so read how to code it in *here:* http://en.wikipedia.org/wiki/JSONP#How_it_works – Cilan Dec 25 '13 at 18:30
  • @user3133630 It looks like you can't put an iframe to that site, I just tried. – Cilan Dec 25 '13 at 18:38