473,398 Members | 2,403 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,398 software developers and data experts.

Is This "AJAX"?

I have some javascript in a standard HTML page that uses the ubiquitous
"XMLHttpRequest" to send data to a remote ASP page.

If that page "answers back" by sending a string using a simple
Response.Write, which I then use in the original HTML page to
dynamically update stuff, is this "AJAX"?

Specifically, is there anything "wrong" with sending back info from
classic ASP pages using simple Response.Writes? (Is there usually
something more required in the "answer back"? Or something that
Response.Write might not be sending, like an appropriate header "AJAX"
header?)

I mean, what I have done works! -- so I wonder if I am missing
something? It seems so easy to do -- I _MUST_ be missing something?
Right?

Thanks,
Blue Apricot

Apr 14 '06 #1
6 2470


bl************@gmail.com wrote:
I have some javascript in a standard HTML page that uses the ubiquitous
"XMLHttpRequest" to send data to a remote ASP page.

If that page "answers back" by sending a string using a simple
Response.Write, which I then use in the original HTML page to
dynamically update stuff, is this "AJAX"?


You can call it AJAX as it uses XMLHttpRequest. You could refuse to call
it AJAX if you don't exchange XML as the X in AJAX stands for XML. But
noone cares anymore whether that terms makes much sense or whether any
of the components (Asynchronous Javascript and Xml) are really used.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Apr 14 '06 #2
SOrry, it is not so much the "term" I am wondering about.

What I am wondering is:

1. Can I use "Response.Write" to send info back to the XMLHttpRequest?
2. Is there any shortcomings to doing so?

Thanks,
B.A.

Apr 14 '06 #3


bl************@gmail.com wrote:
1. Can I use "Response.Write" to send info back to the XMLHttpRequest?
2. Is there any shortcomings to doing so?


Sure you can use Response.Write in an ASP page to write stuff as the
response to an HTTP request. That is what Response.Write is meant for.
And it does not matter if the HTTP request is e.g. made by the browser
because the user asked to load a URI or e.g. by some script executed in
the browser. Processing a HTTP request and writing a response with ASP
does not depend on how the request was made on the client.
As with all responses your ASP makes, you should decide what
Content-Type to send and indicate that with e.g.
Response.ContentType = "application/xml"
or
Response.ContentType = "text/plain"

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Apr 14 '06 #4
Yep!, you are right. You can also send the response data in an XML format and
parse it in the client side to display them.

- Rafiq
http:/www.ajaxtoday.com

"bl************@gmail.com" wrote:
I have some javascript in a standard HTML page that uses the ubiquitous
"XMLHttpRequest" to send data to a remote ASP page.

If that page "answers back" by sending a string using a simple
Response.Write, which I then use in the original HTML page to
dynamically update stuff, is this "AJAX"?

Specifically, is there anything "wrong" with sending back info from
classic ASP pages using simple Response.Writes? (Is there usually
something more required in the "answer back"? Or something that
Response.Write might not be sending, like an appropriate header "AJAX"
header?)

I mean, what I have done works! -- so I wonder if I am missing
something? It seems so easy to do -- I _MUST_ be missing something?
Right?

Thanks,
Blue Apricot

Apr 27 '06 #5
I have question here Martin.

Is there anyway (DHTML) to detect if the content is xml file or text.

right now what I am doing is

'xmlstring = xml file or error code in like "Error:- Error is generated so
and so"

Response.ContentType = "application/xml"
Response.write xmlstring
response.end

my client page DHTML looks like

var sTemp = xmlhttp.responseText
var i = sTemp.indexOf("Error:-") // instead of doing this I wish to detect
if thats xml or not, if xml means go ahead if not display error
if (i >= 0)
{
//display error
return false
}
var nodes = xmlhttp.responseXML.documentElement.getElementsByT agName('abcd')

Martin Honnen wrote:
bl************@gmail.com wrote:
1. Can I use "Response.Write" to send info back to the
XMLHttpRequest? 2. Is there any shortcomings to doing so?


Sure you can use Response.Write in an ASP page to write stuff as the
response to an HTTP request. That is what Response.Write is meant for.
And it does not matter if the HTTP request is e.g. made by the browser
because the user asked to load a URI or e.g. by some script executed
in the browser. Processing a HTTP request and writing a response with
ASP does not depend on how the request was made on the client.
As with all responses your ASP makes, you should decide what
Content-Type to send and indicate that with e.g.
Response.ContentType = "application/xml"
or
Response.ContentType = "text/plain"

May 5 '06 #6

"abcd" <ab**@abcd.com> wrote in message
news:ed**************@TK2MSFTNGP04.phx.gbl...
I have question here Martin.

Is there anyway (DHTML) to detect if the content is xml file or text.

right now what I am doing is

'xmlstring = xml file or error code in like "Error:- Error is generated so
and so"

Response.ContentType = "application/xml"
Response.write xmlstring
response.end

my client page DHTML looks like

var sTemp = xmlhttp.responseText
var i = sTemp.indexOf("Error:-") // instead of doing this I wish to detect
if thats xml or not, if xml means go ahead if not display error
if (i >= 0)
{
//display error
return false
}
var nodes = xmlhttp.responseXML.documentElement.getElementsByT agName('abcd')
A client can reasonably expect to test the content type header to determine
the type of content received. If you are sending plain text then really
ought to be setting the Response.ContentType to text/plain.

if (xmlResponse.getResponseHeader("Content-Type").indexOf("application/xml") -1)

//xml was sent

Personally I prefer to allways send XML even if there is an error. I use
error xml along the lines of:-

<error>
<number>5</number>
<description>Invalid Procedure Call</description>
<source>Somewhere</source>
<error>

Then test if the documentElement has the tag name 'error'.

Anthony.
May 6 '06 #7

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

Similar topics

6
by: John Willems | last post by:
Interesting GUI developments, it seems. Anyone developed a "Ajax" application using Python? Very curious.... thx (Ajax stands for: XHTML and CSS; dynamic display and interaction using the...
7
by: Larry Bud | last post by:
More of a design question than technical.... combining Ajax technology with ASP... Top portion of the page contains several Select boxes which are dependant upon one another. Ajax handles that...
3
by: Tony | last post by:
I've done a fair bit of searching on this, but I want to be certain about what I've found - so here goes with a long example and three questions: For clarity, let me give an example (a number of...
1
by: Tony Lawrence | last post by:
Probably a lot of you here are already old hands at Ajax, but I haven't started doing this yet. Part of the reason was that I really didn't understand where Ajax would be useful to my own site,...
3
by: caston | last post by:
Well, everybody can now agree with the fact that the Ajax hype is over. Still multiple Ajax Frameworks are flourishing, aren't they? So, last night I questioned myself with the following: "When...
2
by: pe3no | last post by:
Hi, I'm going to create applications PHP + AJAX + Linux + Apache + Postgres. - Other Open Source technologies / Frameworks, etc. also :) Is this book http://www.amazon.com/gp/reader/0471777781...
1
by: mark4asp | last post by:
Which should I use: 1. "ASP.NET AJAX-Enabled Web Site" or 2. "AJAX Control Toolkit Web Site"? In the first, controls from the control toolkit start as: <cc1:SomeControl></cc1> In the 2nd,...
5
by: Sommer.pde | last post by:
It took me some time to find out when and why this happens. When the window of Internet Explorer is closed with an AJAX call still pending, something funny happens. Do it twice, and you will have...
11
by: Jonathan Wood | last post by:
Can anyone point me to any good resources on adding AJAX to a page once the page has already been created? I know VS2008 has options to add AJAX pages, but I didn't select those options when the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.