473,761 Members | 10,057 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
Peter Michaux wrote:
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.
Yes you are right, that's not want I meant. I wan't asking anyone to
write anything, I really thought an example would already be close at
hand. I'd be happy with "sorry, we don't know of any working examples."
I'd say "thanks for answering my question. "

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?
That will then let me see the code in context, which is much less
confusing than trying to get pieces to work. I can never get the pieces
to fit together, and even if I do I still don't know if what I've built
will work in all browsers or if I've just done one step in a greater
application.I'm surprised you don't understand the difference.
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.
The tutorials make alot more sense when I can see the code as part of a
working example. Otherwise, its ten times harder to decipher. It seems
like anytime anyone writes a tutorial they skip over the most basic
working examples. They are like you, they don't understand the
importance of basic working examples, in context. They don't understand
what it "gets you".
>
I could make the example this terse

<script src="ajax.js"></script>
<div onclick="doAjax (this)">do ajax</div>
Yes I would love to see a working example of a simple text change even
if it is this terse. I could then look at the code and understand what
it is doing. Out of context, its all greek.
>
But when you look in the ajax.js file you will see it is relatively
complicated or maybe it isn't. It depends.
At least it would be in context, which means everything to me.

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 #21
meltedown wrote:
Peter Michaux wrote:
I could make the example this terse

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

Yes I would love to see a working example of a simple text change even
if it is this terse. I could then look at the code and understand what
it is doing. Out of context, its all greek.
<URL: http://ajaxtoolbox.com/request/examples.php>
<URL: http://forkjavascript. org/ajax/tests#simple>
<URL: http://developer.yahoo .com/yui/examples/connection/get.html>

Peter

Jan 2 '07 #22


Peter Michaux wrote:
meltedown wrote:
>Peter Michaux wrote:
>>I could make the example this terse

<script src="ajax.js"></script>
<div onclick="doAjax (this)">do ajax</div>
Yes I would love to see a working example of a simple text change even
if it is this terse. I could then look at the code and understand what
it is doing. Out of context, its all greek.

<URL: http://ajaxtoolbox.com/request/examples.php>
<URL: http://forkjavascript. org/ajax/tests#simple>
<URL: http://developer.yahoo .com/yui/examples/connection/get.html>

Peter
Thanks, The second one is much closer to what I'm looking for than
anything else I've seen.
Jan 3 '07 #23
meltedown wrote:
>
I can make a form, but I don't know how to use ajax to update text on a
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.

>>
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.
I figured it out. Basically, all I had to do is replace
alert(request.r esponseText);

with

document.getEle mentById('resul t').innerHTML = request.respons eText;

This is basically what I was looking for in my original request:
http://www.reenie.org/test/ajax.htm
This is the simplest working example of Ajax I can conceive of. I'd much
rather look at something like this than some disembodied code in a
tutorial.

Now that I've got a basic ajax application I can study, I'd love to hear
what's wrong with it, if anything, before I start using it and making
it more complicated.


Jan 3 '07 #24
meltedown said the following on 1/2/2007 8:29 PM:
meltedown wrote:
>>
I can make a form, but I don't know how to use ajax to update text on
a 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.

>>>
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.

I figured it out. Basically, all I had to do is replace
alert(request.r esponseText);

with

document.getEle mentById('resul t').innerHTML = request.respons eText;
And I only told you that twice in order to be called a "rude bully". Go
figure.
Now that I've got a basic ajax application I can study, I'd love to hear
what's wrong with it, if anything, before I start using it and making
it more complicated.
Test it. You can get the 3 mainstream browsers for MS Windows for free
(IE, Opera, Mozilla based) and test. If it works in those three then
odds are it will work in most PC based browsers. Then you need a mac
tester and personal experience has taught me that if an ajax page works
in most PC browsers then it will work in most modern mac browsers
(Safari being a possible exception). But then you only need ask for help
with code you made the effort to try to make work instead of asking for
someone to come up with code for you.

--
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 3 '07 #25
Hello,

Now I know who posted all the 'where is the example?' comments on my
blog... LOL.

There appears to be a misunderstandin g of the term 'example' as used on
the site -The site which posted the code uses the term 'example' as in
'Code Example', and not as in 'Working Example', most programming
related sites tend to show Code Examples, and not user interface
examples... this is quite normal. Sorry for the confusion this is
causing you.

However, this is a post which includeds both code:
http://www.ajaxtutorial.net/index.ph...-php-using-res
ponsexml/
and a 'Working Example' of this:
http://www.ajaxtutorial.net/demo/one.php

This above example shows AJAX (with XML returned)... I'd say it would be
a little more complex than the original URL you mentioned though!

*** Sent via Developersdex http://www.developersdex.com ***
Jan 16 '07 #26

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...
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...
0
8768
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5361
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
2733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.