1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Dashcode Ajax request issue.

Discussion in 'Mac Programming' started by Killyp, Jul 12, 2007.

  1. macrumors 68040


    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:

    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
    				//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 :)
  2. macrumors newbie

    I am having the same issue. Anybody got any hints?
  3. macrumors 68030


  4. macrumors newbie

    It seems XMLHTTP Request object gives no error. It just aborts.

    Is there any way I can extract an error from it?
  5. macrumors newbie

    Make sure you are allowing for network access

    Make sure you are allowing for network access in your Info.plist file:



Share This Page