473,760 Members | 9,717 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Ajax example

This is supposed ot be an example:

http://www.ajaxtutorial.net/index.ph...totype-part-2/

It says :

This example is probably the simplest example you will ever find.
We are going to use the prototype feature ‘ajax.Updater’ (see part one
for more details on prototype).

ajax.Updater allows you to specify an element ID and script URL - and
whatever the script URL prints will appear in your element ID. Simple as
that.

I would love to see such an example. Unfortunately, there is no example
on that page.

Does anyone know where there is such an example ?
Jan 2 '07
25 2801
Randy Webb wrote:
meltedown said the following on 1/2/2007 6:08 AM:
>Randy Webb wrote:
>>meltedown said the following on 1/2/2007 5:50 AM:
Dag Sunde wrote:

<snip>

You're kidding, right?
>
it isn't a tutorial on how to make a form post a textfield to
some serverside script, neither a tutorial on how to make serverside
script that returns some text bak to you.
>
You surely know how to do the two things above?

I can make a form, but I don't know how to use ajax to update text
on a page.

You don't use "ajax" to update the page. You use ajax to retrieve the
data from the server. Then, you use that response and update the
page. Check the group FAQ for DynWrite (see my signature) for a
function that will update the page.

There's lots of examples where the results are put into an alert
box, but I've never seen one where the result appears on the page
without reloading the page.

Instead of alert('somethin g') you do
document.getE lementById('som eID').innerHTML = 'something';, or, you
DynWrite it.

It show you an example how to use that particular function
to update an element with the response of a given serverside script.

No it doesn't. It shows the code, but there is no working example.
If you can't take code from the manual and make it work, you need a
different approach.
I don't understand why I can't just ask for a working example without
all the snarky responses. If there is no working example of what I'm
asking for, fine, but that's what I'm looking for.

First, a "complete working example" would have to include the server
side code as well, or, use a static file.
Second, you didn't get a "snarky" response, you got an honest one.
Third, I doubt - very seriously - that you will find very many "complete
working examples" on the web of a complete ajax application.
>
Why not ? As I said before, there's lots of complete working examples of
complete ajax applications where the results are put into an alert box.
Here's a bunch of assorted complete working examples of complete ajax
applications right here, but it doesn't include the most obviously
needed example, that of a simple display of text on the web page.

http://wiki.script.aculo.us/scriptaculous/show/Demos

You are not making any sense to me.
Jan 2 '07 #11
meltedown wrote:
Randy Webb wrote:
<snipped/>
>First, a "complete working example" would have to include the server
side code as well, or, use a static file.
Second, you didn't get a "snarky" response, you got an honest one.
Third, I doubt - very seriously - that you will find very many
"complete working examples" on the web of a complete ajax
application.
>>

Why not ? As I said before, there's lots of complete working examples
of complete ajax applications where the results are put into an alert
box. Here's a bunch of assorted complete working examples of complete
ajax applications right here, but it doesn't include the most
obviously needed example, that of a simple display of text on the web
page.
http://wiki.script.aculo.us/scriptaculous/show/Demos

You are not making any sense to me.
The feeling is mutual... :-)

Oh, for God's sake... here you go:
(Completely untested, from the top of my head sample)

server.asp:
<%@ Language=VBScri pt %>
<%Response.Buff er = True%>
<%
Response.Buffer = True
Dim s

Response.Conten tType ="text/html"
Response.CacheC ontrol = "Private"
Response.AddHea der "Cache-Control", "no-cache"

If Not isempty(Request .Form("someStri ng")) Then
s = "<h1>" & Request.Form("s omeString") & "</h1>"
Else
s = "<h1>you didn't say anything</h1>"
End If
Response.Write s
Response.End()
%>

test.html:
<html
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>TestSome AjaxThingy</title>
<script src="/scripts/prototype.js" type="text/javascript"></script>
<script type="text/javascript">
function sendIt() {
}
</script>
</head>

<body>
<input type="text" id="someString " name="someStrin g" value="" /><br />
<input type="button"
id="btnSend"
name="btnSend"
value="Send"
onclick="new Ajax.Updater('r esults', 'server.asp',
{asynchronous:t rue});"/>
<br />
<div id="results">I t should appear here</div>
</body>
</html>
Note: I've never used prototype.js in my life, but the above is the
principle.

--
Dag.

Listen to your brain - it has a lot of information.
(Chelsey, 7) -
Jan 2 '07 #12
Dag Sunde wrote:
meltedown wrote:
>Randy Webb wrote:
<snipped/>
>>First, a "complete working example" would have to include the server
side code as well, or, use a static file.
Second, you didn't get a "snarky" response, you got an honest one.
Third, I doubt - very seriously - that you will find very many
"complete working examples" on the web of a complete ajax
application .
Why not ? As I said before, there's lots of complete working examples
of complete ajax applications where the results are put into an alert
box. Here's a bunch of assorted complete working examples of complete
ajax applications right here, but it doesn't include the most
obviously needed example, that of a simple display of text on the web
page.
http://wiki.script.aculo.us/scriptaculous/show/Demos

You are not making any sense to me.

The feeling is mutual... :-)

Oh, for God's sake... here you go:
(Completely untested, from the top of my head sample)

server.asp:
<%@ Language=VBScri pt %>
<%Response.Buff er = True%>
<%
Response.Buffer = True
Dim s

Response.Conten tType ="text/html"
Response.CacheC ontrol = "Private"
Response.AddHea der "Cache-Control", "no-cache"

If Not isempty(Request .Form("someStri ng")) Then
s = "<h1>" & Request.Form("s omeString") & "</h1>"
Else
s = "<h1>you didn't say anything</h1>"
End If
Response.Write s
Response.End()
%>

test.html:
<html
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>TestSome AjaxThingy</title>
<script src="/scripts/prototype.js" type="text/javascript"></script>
<script type="text/javascript">
function sendIt() {
}
</script>
</head>

<body>
<input type="text" id="someString " name="someStrin g" value="" /><br />
<input type="button"
id="btnSend"
name="btnSend"
value="Send"
onclick="new Ajax.Updater('r esults', 'server.asp',
{asynchronous:t rue});"/>
<br />
<div id="results">I t should appear here</div>
</body>
</html>
Note: I've never used prototype.js in my life, but the above is the
principle.
>
Oh for Gods sake yourself. Do you know the difference between code and a
working example ?
Jan 2 '07 #13
"meltedown" <as**@fake.comw rote in message
news:B2******** *************@f e10.news.easyne ws.com...
Oh for Gods sake yourself. Do you know the difference between code and a
working example ?
http://xwire.solutionpioneers.com/treeTableDemo.html

(IE or FireFox 1.5 only)
Jan 2 '07 #14
meltedown wrote:
>
Oh for Gods sake yourself. Do you know the difference between code and a
working [Ajax] example ?
For a working example please see

<URL: http://gmail.com/>

Peter

Jan 2 '07 #15
meltedown wrote:
Dag Sunde wrote:
<snipped/>
> </body>
</html>
Note: I've never used prototype.js in my life, but the above is the
principle.
>>
Oh for Gods sake yourself. Do you know the difference between code
and a working example ?
You're welcome.

Always nice to help!

:-D

--
Dag.

Listen to your brain - it has a lot of information.
(Chelsey, 7) -
Jan 2 '07 #16
David Gillen wrote:
meltedown said:
>Dag Sunde wrote:
>>meltedown wrote:
Randy Webb wrote:
<snipped/>
First, a "complete working example" would have to include the server
side code as well, or, use a static file.
Second, you didn't get a "snarky" response, you got an honest one.
Third, I doubt - very seriously - that you will find very many
"complete working examples" on the web of a complete ajax
application .
Why not ? As I said before, there's lots of complete working examples
of complete ajax applications where the results are put into an alert
box. Here's a bunch of assorted complete working examples of complete
ajax applications right here, but it doesn't include the most
obviously needed example, that of a simple display of text on the web
page.
http://wiki.script.aculo.us/scriptaculous/show/Demos

You are not making any sense to me.
The feeling is mutual... :-)

Oh, for God's sake... here you go:
(Completely untested, from the top of my head sample)

server.asp:
<%@ Language=VBScri pt %>
<%Response.Bu ffer = True%>
<%
Response.Buffer = True
Dim s

Response.Conten tType ="text/html"
Response.CacheC ontrol = "Private"
Response.AddHea der "Cache-Control", "no-cache"

If Not isempty(Request .Form("someStri ng")) Then
s = "<h1>" & Request.Form("s omeString") & "</h1>"
Else
s = "<h1>you didn't say anything</h1>"
End If
Response.Write s
Response.End()
%>

test.html:
<html
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>TestSome AjaxThingy</title>
<script src="/scripts/prototype.js" type="text/javascript"></script>
<script type="text/javascript">
function sendIt() {
}
</script>
</head>

<body>
<input type="text" id="someString " name="someStrin g" value="" /><br />
<input type="button"
id="btnSend"
name="btnSend"
value="Send"
onclick="new Ajax.Updater('r esults', 'server.asp',
{asynchronous :true});"/>
<br />
<div id="results">I t should appear here</div>
</body>
</html>
Note: I've never used prototype.js in my life, but the above is the
principle.
Oh for Gods sake yourself. Do you know the difference between code and a
working example ?
And that's what you get when you feed a troll.

D.
I didn't do anything trollish at all. I simply asked for a simple
working example of an Ajax script that would change text on a page and I
haven't seen one yet. I have seen a bunch of answers from people who
don't seem to understand the request, or are pretenting they don't
understand. I have really really hard time understanding something like
the code above. I can look at it for hours and hours and it makes no
sense. Its Greek. And I have really hard time getting it to work. But If
I can see it in a working, example, after about 5 minutes, it is much
more clear. So my question is not ridiculous. What is ridiculous is the
idea that I have written anything that is remotely wrong or confusing to
any honest person.

You guys are bunch of rude bullies.
Jan 2 '07 #17
meltedown said the following on 1/2/2007 4:08 PM:
David Gillen wrote:
>meltedown said:
<snip>
>>Oh for Gods sake yourself. Do you know the difference between code
and a working example ?
And that's what you get when you feed a troll.

D.
I didn't do anything trollish at all.
You come ask for an example, you get more of an example than most people
are willing to bother with, and then you complain about that?
I simply asked for a simple working example of an Ajax script that
would change text on a page and I haven't seen one yet. I have seen
a bunch of answers from people who don't seem to understand the
request, or are pretenting they don't understand.
I explained to you, in this thread, that if you look in this groups FAQ
(which is in my signature) and search for "DynWrite" that you would find
an entry that shows how to make it modify the page itself instead of
using an alert.

The steps for an "ajax request" go, in plain English, like this:

1) User says "Give me that data".
2) Browser requests that data from the server.
3) Server sends that data to the browser.
4) Browser displays that data.
5) User gets the data.

The only step in that list that you have wanted changed was step 4 which
is how the browser displays that data. The examples you have posted
URL's to use an alert to display it.

Yet, you want someone to write all 5 steps, from scratch, just for you
and you complain when they won't. This isn't a help desk, its a
discussion group.
You guys are bunch of rude bullies.
If not writing a full blown app just for you makes me a bully, then I
will remain a bully until I get paid for writing that app for you.

<URL: http://www.ajaxtoolbox .com/>

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 2 '07 #18
meltedown wrote:
David Gillen wrote:
<snipped/>
>And that's what you get when you feed a troll.

D.
I didn't do anything trollish at all. I simply asked for a simple
working example of an Ajax script that would change text on a page
and I haven't seen one yet. I have seen a bunch of answers from
people who don't seem to understand the request, or are pretenting
they don't understand. I have really really hard time understanding
something like the code above. I can look at it for hours and hours
and it makes no sense. Its Greek. And I have really hard time getting
it to work. But If I can see it in a working, example, after about 5
minutes, it is much more clear. So my question is not ridiculous.
What is ridiculous is the idea that I have written anything that is
remotely wrong or confusing to any honest person.

You guys are bunch of rude bullies.
No, we're not!

The sample I actually took time to sit down and write specifically
for you is what I thought you need (and meant).

I had no idea that that you needed a ready-made web-site with
a button to click on.

I believed you needed the source-code for an working example
so you could set it up on your own machine to experiment with,
and that was *excactly* what I gave you:
The content of 2 files. server.asp and test.html to put somewhere
on your IIS server. Then you could point your browser to
http://yourserver/test.html, and tested/played with the *working
example*

If the code was greek to you, you could have posted further questions
here, to get specific points clarified.

If you don't even know how to set up those two files I posted on your
own webserver, you could have said: "Wow! Thanks! But how do I use them?
Can you please take the time to help me set it up, so it runs on my
computer?"

Believe me, everyone that have replied to you have really tried
to help you, despite your sometimes "snotty", whining remarks.

--
Dag.

Listen to your brain - it has a lot of information.
(Chelsey, 7) -
Jan 2 '07 #19
meltedown wrote:
>
I didn't do anything trollish at all. I simply asked for a simple
working example of an Ajax script that would change text on a page and I
haven't seen one yet.
This implies you *expect* someone here to give it to you. People here
are *extremely* helpful if you ask politely, you gloss over any
perceived abrasiveness that may simply be a result of quickly chosen
words and you are patient.

I have seen a bunch of answers from people who
don't seem to understand the request, or are pretenting they don't
understand.
The person taking the time to reply probably thought they were being
helpful by pointing you in the right direction and then you could take
the next step of investigation.

I have really really hard time understanding something like
the code above. I can look at it for hours and hours and it makes no
sense. Its Greek. And I have really hard time getting it to work. But If
I can see it in a working, example, after about 5 minutes, it is much
more clear.
In a working example you are probably going to see something clicked
and then text appear on the screen. Where will that get you? You will
then have to look at the code and for Ajax that requires a bit of
theory and probably a tutorial which is what you've bocked at reading.

I could make the example this terse

<script src="ajax.js"></script>
<div onclick="doAjax (this)">do ajax</div>

But when you look in the ajax.js file you will see it is relatively
complicated or maybe it isn't. It depends. You need to spend the time
to read the tutorials . . .

On the group faq look for books and get Flanagan's fifth edition and
read the chapter on Ajax. Then realize that there are bugs in that
chapter and look at the errata on the O'Reilly site. Then realize that
not all the bugs have been posted there yet and that there are issues
with IE memory leaks and IE/Firefox XHR abort() calls.

<URL: http://jibbering.com/faq/>

If you don't want to do any of the above then just use a pre-made
library like ajaxtoolbox or yahoo ui and follow the tutorials on those
sites. The Yahoo! UI lib might be a better fit for you because there is
a special Yahoo! group/email list for discussing the YUI libraries.

Peter

Jan 2 '07 #20

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

Similar topics

4
4326
by: bobzimuta | last post by:
I'm creating a simple AJAX library. It's an object that will return an array containing the response text or xml. I'm trying to find a way to assign the response as a property of the object, but from within an inline function. Within the AJAX object: this.xmlhttp = new XMLHttpRequest(); this.response = ''; //to contain the response text OR xml var that = this; //since we cannot reference this within the
8
1776
by: needin4mation | last post by:
I understand this is a asp.net group, but thought I would post this here for comments. I admit I have used this post in another group, but it has less traffic. Here's to hoping I'm just blind to the obvious: I have been reading a lot about AJAX. I want to use it and will. But I keep reading about how it doesn't make a roundtrip to the server, no postback, etc. But isn't the truth that *something* makes a trip to the server? It may...
2
1860
by: Alex | last post by:
Example uploaded to: http://www.clickatus.com/ajax/ BTW - This is for FIREFOX, won't work in IE. I don't know why but when it is executed the browser still in loading state... Even though XMLHttpRequest already got its string from the server... Any help?
7
3772
by: Ivan Marsh | last post by:
Hey Folks, I'm having a heck of a time wrapping mind around AJAX. Anyone know of a simple, straight-forward example for pulling a simple query from mysql with PHP using AJAX? As I understand it I need a PHP script that pulls the query and dumps the data into XML format, that is called by triggering a javascript event that reads that file with XMLhttprequest.
31
3161
by: Tony | last post by:
I just noticed that prototype.js is one of the files in the Ajax.NET distribution - I'm pretty concerned about this. Does anyone know if this is the same "prototype.js" that is not well-liked around here? If so, do you know if Ajax.NET can be used without prototype.js? -- "The most convoluted explanation that fits all of the made-up facts is the most likely to be believed by conspiracy theorists. Fitting the
1
16512
by: www.web20developers.com | last post by:
http://www.web20developers.com http://www.web20developers.com/index.php?option=com_content&task=view... Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell AJAX - microlink pattern tutorial : A microlink is a link that opens up
3
2775
by: BG Mahesh | last post by:
hi We are looking for a good Ajax library which has very good support for iframe. The ones we have considered so far are, Backbase.com - not happy with the speed Zapatech.com - it is good but doesn't have support for iframe openreco.org - it is good but doesn't support iframe Any pointers is appreciated. We are doing the development on Linux.
17
11882
by: Arjen | last post by:
Hi, I want to reload 2 divs at one click. Ive tried: <a href = "javascript:void(0);" onclick="show('ajaxrequest.php?action=removefield','div1');show('ajaxrequest.php?action=reloaddiv2','div2')">verwijderen</a> While both seperate actions work they dont when I put them together. Anyone know how to fix this ? My ajax.js with funcition show
0
9521
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10107
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9945
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9900
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9765
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7324
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3863
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3442
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.