Dashcode Ajax request issue.

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

  1. Killyp macrumors 68040


    Jun 14, 2006
    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. linuxftw macrumors newbie

    Jun 25, 2007
    I am having the same issue. Anybody got any hints?
  3. superbovine macrumors 68030


    Nov 7, 2003
  4. linuxftw macrumors newbie

    Jun 25, 2007
    It seems XMLHTTP Request object gives no error. It just aborts.

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

    Mar 23, 2007
    Make sure you are allowing for network access

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



Share This Page