I have been trying to create a widget to request a server and display the number of email messages you have using Dashcode.
However, the XMLHTTP request object seems to be aborting before doing anything. The readystate property is set to 4 and the status is set to 0, According to what I have discovered from the internet, this means it has aborted. I am sure my URL is correct, yet it still won't work.
Here is my code:
Thanks in advance
However, the XMLHTTP request object seems to be aborting before doing anything. The readystate property is set to 4 and the status is set to 0, According to what I have discovered from the internet, this means it has aborted. I am sure my URL is correct, yet it still won't work.
Here is my code:
Code:
var xmlhttp = create_object(); //this creates the xmlhttprequest object, I know this works as its been tested in browsers, safari (3), firefox and IE
xmlhttp.open('POST', 'http://boshty.co.uk/mail/list_messages.php', true);
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4)
{
if (xmlhttp.status == 200)
{
//request worked
}
else
{
//error, this is where we always end up. Ready state 4, status 0.
}
}
}
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); //because we are sending data
xmlhttp.send("f=inbox"); //this needs to be sent.
Thanks in advance