[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 07-26-2008, 09:33 AM   #1 (permalink)
Senior Member
 
nasaboy007's Avatar
 
Join Date: Jul 2005
Location: NJ
Posts: 1,112
1,454.30 NP$ (Donate)

nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of


AJAX "Access is Denied" Error

I am attempted to make a firefox add-on that will send data to an external server (sort of like those stumbleupon and del.icio.us addons) with information about what page you're on. however, i want to do this with ajax rather than with forms. The info is populated with predefined variables and are populated with prompt / other info.

now, my problem is that since i'm trying to send the data to an external server, my ajax keeps returning an "access is denied" error. (i actually spent a really long time figuring that out - firefox didn't give any errors since it was an extension... i eventually had to make a new file of jus the ajax to test it in ie so i could see the exact error.)

i tried changing the chmod of the files on my server to 777 and i still got the access denied error. is there some way to get it to work?

or will i have to like open a new window with a page from my site and let them do their stuff there? (since thats what those social bookmarking sites seem to do... i think... but all of the windows look similar if not the same just a different header, so im not so sure).

thanks



EDIT:
I found the solution at
http://developer.mozilla.org/en/docs...XMLHttpRequest

All it took was adding:
PHP Code:
<?php header('Access-Control: allow <*>'); ?>
to my php file that was doing the processing.

However, i believe this only works for the newest browsers, but since I'm writing a firefox addon i can just make it for firefox 3.0+ (since this is what i believe it works on)

Last edited by nasaboy007; 07-27-2008 at 10:31 AM. Reason: Solved
nasaboy007 is offline  
Old 07-26-2008, 01:15 PM   #2 (permalink)
NamePros Member
 
Join Date: Sep 2006
Posts: 87
100.00 NP$ (Donate)

Bruce_KD will become famous soon enoughBruce_KD will become famous soon enough


I have never worked with Firefox addons.
However, in conventional Browser JavaScript, you may only use Ajax to access a file in that site.

For example, a script on www.bruce.com couldn't open something from www.anothersite.com. Attempting to do so would throw a forbidden error.
(Interestingly enough, even calling http://bruce.com/file.php isn't possible from http://www.bruce.com/script.js. Even the subdomain must be the same.)

Is there a chance that Ajax is not the tool you should be using? You may want to research different methods of Firefox addon data retrieval.


Bruce
Bruce_KD is offline  
Old 07-26-2008, 06:57 PM   #3 (permalink)
Senior Member
 
nasaboy007's Avatar
 
Join Date: Jul 2005
Location: NJ
Posts: 1,112
1,454.30 NP$ (Donate)

nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of


I see. Well, firefox addons are basically XML to make the menus, which call javascript functions with oncommand (aka onclick, etc). so i think the only way to do it would be with javascript... what other ways are there to send data to and from external servers since ajax won't work? i only know th ebasics of javascript, and am no pro.
nasaboy007 is offline  
Old 07-27-2008, 10:32 AM   #4 (permalink)
Senior Member
 
nasaboy007's Avatar
 
Join Date: Jul 2005
Location: NJ
Posts: 1,112
1,454.30 NP$ (Donate)

nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of


Found the solution and edited my first post with the answer for those who might have the same/similar question.

Thanks everyone.
nasaboy007 is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 02:02 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85