Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 4.50 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-22-2008, 07:50 AM   PM User | #1
fairuz.ismail
New to the CF scene

 
Join Date: Feb 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
fairuz.ismail is an unknown quantity at this point
ajax - status 0 or 200?

Just a question about ajax fundamental, i know that to check if the response is served correctly we should check xmlhttp.status == 200 .But is it true that if we working with local files, we must use 0 instead of 200?

thanks.
fairuz.ismail is offline   Reply With Quote
Old 02-22-2008, 08:02 AM   PM User | #2
mjlorbet
Regular Coder

 
mjlorbet's Avatar
 
Join Date: Jan 2008
Location: Milwaukee, WI
Posts: 724
Thanks: 8
Thanked 96 Times in 95 Posts
mjlorbet will become famous soon enough
anything coming out of an xhr request should have a status of 200 & a readystate of 4 if it's been properly received, regardless of origin because the request is going out on the xhr object assuming it's looking to a server. if you're talking about accessing a file on a user's machine, then it's perhaps better to use a cookie instead, or just cache your session or user data in a database, create a webservice or a passthrough page to extract your data from. most browsers will alert the user if the website they're on is attempting to access their machine. most people frown on this. moreover, if the file is already on the user's machine, there's no need to use an xhr for it, the file is already ready to go.
__________________
-Mike
"Want me to precludify him, like some kind of dispatcherator?... Can do!" -Bender
mjlorbet is offline   Reply With Quote
Old 02-22-2008, 10:26 AM   PM User | #3
nikku
New Coder

 
Join Date: Feb 2008
Posts: 19
Thanks: 4
Thanked 0 Times in 0 Posts
nikku is an unknown quantity at this point
Quote:
Originally Posted by fairuz.ismail View Post
Just a question about ajax fundamental, i know that to check if the response is served correctly we should check xmlhttp.status == 200 .But is it true that if we working with local files, we must use 0 instead of 200?

thanks.
hello fairuz,

Ya its true that if you are using a local file the status will be 0.
nikku is offline   Reply With Quote
Old 02-22-2008, 11:30 AM   PM User | #4
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,554
Thanks: 9
Thanked 480 Times in 463 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
i find it easier to simply check for responseText...
its only there when you want to apply the event.
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:15.2% IE7:0.5% IE8:8.4% IE9:8.5% IE10:8.5%
rnd me is offline   Reply With Quote
Old 02-22-2008, 04:50 PM   PM User | #5
fairuz.ismail
New to the CF scene

 
Join Date: Feb 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
fairuz.ismail is an unknown quantity at this point
Quote:
Originally Posted by nikku View Post
hello fairuz,

Ya its true that if you are using a local file the status will be 0.
thanks for clarifying this for me tho.
fairuz.ismail is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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


All times are GMT +1. The time now is 04:59 AM.


Advertisement
Log in to turn off these ads.