473,320 Members | 2,000 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

http status codes and javascript

if I have a javascript function which calls a servlet. The servlet returns
is a HTTP status code of 204 along with a message can a javascript function
be made to parse the message? If so could I have a example.

Thank you
Ox
Jul 23 '05 #1
3 11871


Oxnard wrote:
if I have a javascript function which calls a servlet. The servlet returns
is a HTTP status code of 204 along with a message can a javascript function
be made to parse the message? If so could I have a example.


If you already have a function that calls a servlet then you probably
know what to do:
var httpRequest;
if (typeof XMLHttpRequest != 'undefined') {
httpRequest = new XMLHttpRequest();
httpRequest.open('GET', 'whatever.jsp', false);
httpRequest.send(null);
alert(httpRequest.status + ' ' + httpRequest.statusText);
}
Should do with Mozilla, Netscape, Safari 1.2.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:41***********************@newsread4.arcor-online.net...


Oxnard wrote:
if I have a javascript function which calls a servlet. The servlet returns is a HTTP status code of 204 along with a message can a javascript function be made to parse the message? If so could I have a example.


If you already have a function that calls a servlet then you probably
know what to do:
var httpRequest;
if (typeof XMLHttpRequest != 'undefined') {
httpRequest = new XMLHttpRequest();
httpRequest.open('GET', 'whatever.jsp', false);
httpRequest.send(null);
alert(httpRequest.status + ' ' + httpRequest.statusText);
}
Should do with Mozilla, Netscape, Safari 1.2.

--

Martin Honnen
http://JavaScript.FAQTs.com/


I guess no IE?
Jul 23 '05 #3


Oxnard wrote:

I guess no IE?


IE on Windows can do it too:
var httpRequest;
if (typeof ActiveXObject != 'undefined') {
httpRequest = new ActiveXObject('Microsoft.XMLHTTP');
...
}

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Gianni Mariani | last post by:
I'm involved in a new project and a new member on the team has voiced a strong opinion that we should utilize exceptions. The other members on the team indicate that they have either been burned...
1
by: chris fink | last post by:
Hi, What are the appropriate HTTP Status Codes for the following: 1. XML is not well-formed (structure problem).... 2. XML is not valid (as per DTD/XSD/XDR).....missing req'd field, etc I...
2
by: bwmiller16 | last post by:
Anyone - Can anybody tell me where I would find the linux status codes for such udb utilities as backup, etc.? For instance, in my cron job I have: db2 backup database $dir to $BACKUP_DIR...
6
by: Andy Fish | last post by:
Hi, I've RTFM'd in vain for some named constants in the asp.net framework representing the HTTP error codes - the equivalent of Java's HttpServletResponse.SC_NOT_FOUND for 404 etc. All the...
0
by: Daniel Kopp | last post by:
Hi! I tried to implement custom error pages using the <customErrors> directive in a web.config file. It worked fine for "simple" errors like HTTP 404, like this example: <customErrors...
1
by: chen | last post by:
We're having an internal debate about the merits & demerits of returning status codes in the output message vs exceptions to signify errors in handling a Web method. The status code camp is...
1
by: Alvin A. Delagon | last post by:
Greetings! Is there any way I can obtain the HTTP status codes when using the urllib module? As of now I can only think of doing a regex on the result of the read(). Thanks in advance! ^_^
2
by: Bob | last post by:
I'm running sql server ver 7.0 SP4. I have an access project (.adp) that runs a view which is nothing more than a select statement. Access locks up solid when I try to run this query - with NO...
4
by: dols | last post by:
Hello, below the fragment that works fine, but nevertheless, the value of xmlhttp.status turns out to be zero (0), and the corresponding value for xmlhttp.statusText is "unknown". Does anyone...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.