Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 12, 2007, 12:01 PM   #1
Killyp
macrumors 68040
 
Killyp's Avatar
 
Join Date: Jun 2006
Dashcode Ajax request issue.

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:

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
Killyp is offline   0 Reply With Quote
Old Jul 15, 2007, 01:10 PM   #2
linuxftw
macrumors newbie
 
Join Date: Jun 2007
I am having the same issue. Anybody got any hints?
linuxftw is offline   0 Reply With Quote
Old Jul 15, 2007, 06:30 PM   #3
superbovine
macrumors 68030
 
superbovine's Avatar
 
Join Date: Nov 2003
You didn't say what error you were getting my guess is you ran into a cross-domain issue.

you can google for cross-domain widget or xmlhttprequest etc. Yahoo has a pretty good diagram of what is going on there is several techinques to get around it.

http://developer.yahoo.com/javascript/howto-proxy.html
http://ajaxian.com/archives/how-to-m...in-your-domain
http://forums.widgetbox.com/viewtopic.php?pid=36
superbovine is offline   0 Reply With Quote
Old Jul 23, 2007, 03:57 PM   #4
linuxftw
macrumors newbie
 
Join Date: Jun 2007
It seems XMLHTTP Request object gives no error. It just aborts.

Is there any way I can extract an error from it?
linuxftw is offline   0 Reply With Quote
Old Jan 17, 2008, 01:04 PM   #5
inCider
macrumors newbie
 
Join Date: Mar 2007
Make sure you are allowing for network access

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

<key>AllowNetworkAccess</key>
<true/>

HTH,
inCider

Last edited by inCider; Jan 17, 2008 at 01:14 PM. Reason: typo
inCider is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
dashcode help fracksoup Mac Programming 1 Nov 15, 2013 01:10 PM
How to get Dashcode bb13 Mac Programming 3 Aug 4, 2013 11:39 AM
Dashcode; Javascript; Nexus 7 Issue. LazyBrush Web Design and Development 3 Apr 18, 2013 08:07 AM
Issue with sync request and calls to UI elements nashyo iPhone/iPad Programming 2 Dec 30, 2012 02:32 AM
Dashcode on ML? mathcolo Mac Programming 1 Aug 15, 2012 05:56 PM

Forum Jump

All times are GMT -5. The time now is 11:58 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC