views:

94

answers:

1

Hi!

I've created a web app in Mac OS 10.5 which receives data by sending http requests like this:

var http = new XMLHttpRequest();

var url = "http://www.test1234.com/data.php?param1=" + param1 + "&param2=" + param2 + "&param3=" + param3;

http.onreadystatechange= function() 
{
    var result= null;
    switch(http.readyState)
    {
        case 4:
            if(http.status==200)
            {
                result = eval('(' + http.responseText + ')');
                result = result[0];
                if (result.status == "OK") {
                    alert("Success!");
                    return;
                }

                alert("Error!");
            }else{
                alert("Error
            }
            break;
        default:

            break;
    }
}
http.open("GET", url, true);
http.setRequestHeader("Content-type", "text/xml; charset=utf-8");
http.send(null);

It worked fine in the 10.5 iPhone simulator (Xcode 3.1.4), it still works fine on my devices (when it's deployed to the server) - but it doesn't work in the 10.6.2 simulator (Xcode 3.2.1). It never reaches the http.onreadystatechange method.

Any ideas?

Regards, Jonas

A: 

Well for one, you're missing a closing quote, parenthesis and semi-colon here:

alert("Error

Have you tried using any other browsers to test with other than Safari in the simulator?

Sangraal