473,498 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AJAX Example

RamananKalirajan
608 Contributor
Hi Guys I am new to AJAX. I am in need of an AJAX example which includes Prototype. My Requirement is from a prototype i must create a AJAX call and call a HTML file or Java file without server and print the response back in the caller file. If you guys can help me put pls help me

Regards
Ramanan Kalirajan
Jul 24 '08 #1
2 1527
gits
5,390 Recognized Expert Moderator Expert
please post what you have so far ... so that we have something to work with ...

kind regards
Jul 24 '08 #2
RamananKalirajan
608 Contributor
please post what you have so far ... so that we have something to work with ...

kind regards

Thank you very much Mr. Gits I completed my Task. The code is

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. </head>
  4. <form>
  5. <input type="button" id="myButton" value="Click Me">
  6. <br/>
  7. <div id="container"></div>
  8. </form>
  9. </html>
  10. <script src="prototype.js"></script>
  11. <script language="javascript">
  12. $('myButton').observe('click',function(){
  13.          var myObj = new myClass();
  14.          myObj.test(); 
  15. });
  16.  
  17. var myClass = Class.create({
  18.        initialize :  function(){
  19.       },
  20.  
  21.       test : function(){
  22.          new Ajax.Request("MyNew.html",{
  23.                     method: 'get',
  24.                     onSuccess: function(transport){
  25.                         var res = transport.responseText;
  26.                         new myClass().myHandler(res);
  27.                     }
  28.             });
  29.        },
  30.  
  31.            myHandler : function(val)
  32.            {
  33.                  var cont = $('container');
  34.                  var content = val;
  35.                  cont.update(content);
  36.            }  
  37.   });
  38.  
  39. </script>
While running this file please create an ordinary HTML file with the name "MyNew.html" and have the latest Prototype.js file within the directory.
Those who are starting with AJAX can use this code. It will be very useful.

Regards
Ramanan Kalirajan
Jul 25 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
4286
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...
8
1755
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...
2
1845
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...
7
3743
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...
31
3070
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...
1
16469
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 -...
3
2752
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...
25
2749
by: meltedown | last post by:
This is supposed ot be an example: http://www.ajaxtutorial.net/index.php/2006/11/30/simple-ajax-using-prototype-part-2/ It says : This example is probably the simplest example you will ever...
17
11835
by: Arjen | last post by:
Hi, I want to reload 2 divs at one click. Ive tried: <a href = "javascript:void(0);"...
0
7005
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...
1
6891
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...
0
7381
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
5465
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,...
1
4916
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...
0
4595
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...
0
3087
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1424
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 ...
1
659
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.