Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 12, 2007, 11:01 AM   #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, 12: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, 05: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, 02: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, 12: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 12: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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Help writing a WebApp with Dashcode iJC-1976 Mac Programming 3 May 11, 2011 12:48 AM
show list in Dashcode - Execution exceeded timeout jarv Web Design and Development 0 Feb 9, 2011 06:29 AM
dashcode errors in custom JavaScript jarv Web Design and Development 2 Jan 23, 2011 05:31 AM
Issues Writing a WebApp iJC-1976 iPhone and iPod touch Apps 0 Jan 7, 2011 01:24 PM
Safari AJAX/Javascript issues... things not loading benguild Mac Basics and Help 0 May 14, 2010 11:47 AM


All times are GMT -5. The time now is 02:03 AM.

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

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