displaying in ajax

displaying in ajax

View Answers

October 25, 2008 at 10:49 AM

Hi friend,

Ajax example to solve the problem :

"mainpage.jsp"

<html>
<head>

<title>Ajax Example</title>

<script language="Javascript">

function postRequest(strURL) {

var xmlHttp;

if (window.XMLHttpRequest) { // Mozilla, Safari, ...

var xmlHttp = new XMLHttpRequest();

} else if (window.ActiveXObject) { // IE

var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");

}

xmlHttp.open('POST', strURL, true);

xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

xmlHttp.onreadystatechange = function() {

if (xmlHttp.readyState == 4) {

updatepage(xmlHttp.responseText);

}

}

xmlHttp.send(strURL);

}


function updatepage(str){

document.getElementById("result").innerHTML =

"<font color='red' size='5'>" + str + "</font>";;

}

function showCurrentTime(){

var rnd = Math.random();

var url="process.jsp";

postRequest(url);

}

</script>

</head>

<body>

<h1 align="center"><font color="#000080">Ajax Example</font></h1>

<p><font color="#000080">&nbsp;This very simple Ajax Example retrieves the

current date and time from server and shows on the form. To view the current

date and time click on the following button.</font></p>

<form name="f1">

<p align="center"><font color="#000080">&nbsp;<input value=" Show Time "

type="button" onclick='JavaScript:showCurrentTime()' name="showdate"></font></p>

<div id="result" align="center"></div>

</form>

<div id=result></div>

</body>

</html>


"process.jsp"

<%@ page import="java.util.*" %>
<%
out.println(new Date());
%>

For more information,Tutorials and Examples on Ajax visit to :

http://www.roseindia.net/ajax/

Thanks





December 4, 2011 at 8:12 PM

Simple AJAX application using java script and JSP.

Files required.

  1. ajax.js
  2. mainpage.jsp
  3. process.jsp
  4. web.xml

For more information,Tutorials and Examples on Ajax visit to :









Related Tutorials/Questions & Answers:
displaying - Ajax
displaying  hi.. im sending request from ajax page to servlet ..as in response i need the get the from database to servlet and from servlet to ajax in column wise.. i have to display the response column wise in the same
displaying in ajax - Ajax
displaying in ajax  hi.. I have an Ajax page ,request gone to server... for the answer  Hi friend, Ajax example to solve the problem : "mainpage.jsp" Ajax Example function postRequest
Advertisements
displaying List of records from database in a jsp using ajax
displaying List of records from database in a jsp using ajax  Sir, I...; In between the <div></div> I have to display the records. I am displaying...(); } } return list; } } And ajax code is not fetching the updated
displaying List of records from database in a jsp using ajax, onclick it should display the results ?? its urgent can u help me
displaying List of records from database in a jsp using ajax, onclick it should display the results ?? its urgent can u help me   displaying List of records from database in a jsp using ajax, onclick it should display the results
ajax
ajax  please describe the ajax
Ajax
Ajax  How to learn AJAX
Ajax
Ajax  Hi, What is Ajax? What is the use of Ajax? Thanks   Hi, Ajax is set of technologies used to develop dynamic web applications. In Ajax following technologies is used: a) JavaScript b) XML c) HTTP d) CSS Learn
First Ajax Example
Ajax Application for displaying the current date and time. Date and time...Ajax First Example - Print Date and Time   ... processing. ADS_TO_REPLACE_1 These days Ajax is being used extensively
Ajax
Ajax  how to impliment ajax in registration table using jsp-servlet
Ajax
Ajax  send the example to fetch the data from the server by using ajax in java. for ex:-if there are states which is used to display in frontend we use ajax. send it to me
Ajax
Ajax  how to include ajax in jsp page?   Hi, Please read Ajax First Example - Print Date and Time example.ADS_TO_REPLACE_1 Instead of using PHP you can write your code in JSP. Thanks
ajax
ajax  how to connect ajax with mysql without using php,asp or any other scripting language. please answer soon
Ajax - Ajax
Ajax  What is Ajax ? How one can use ajax with Java
ajax
ajax  HI, In my application using ajax if i type a managername in the textbox it should display all the employees under the that manager... me reg this. thanks KK   Combobox box using Ajax in JSP   i
ajax
ajax  I am facing following problem, I am using ajax to get the data continousely without refreshing. Here i have devided a web page into 3 parts(top,left and right) using table in jsp. On the left part i am displaying some
Ajax
ajax where instead of a link a radio button can fetch the data and can populate a table.If ajax can be used,it would be a greater advantage.After fetching data
ajax
ajax  How can we fetch data in ajax through servlet?   "mainpage.jsp" <html> <head> <title>Ajax Example</title>...;/head> <body> <h1 align="center"><font color="#000080">Ajax
ajax
ajax  How can we fetch data in ajax through servlet?   "mainpage.jsp" <html> <head> <title>Ajax Example</title>...;/head> <body> <h1 align="center"><font color="#000080">Ajax
ajax
ajax  How can we fetch data in ajax through servlet?   "mainpage.jsp" <html> <head> <title>Ajax Example</title>...;/head> <body> <h1 align="center"><font color="#000080">Ajax
ajax
ajax  How can we fetch data in ajax through servlet?   "mainpage.jsp" <html> <head> <title>Ajax Example</title>...;/head> <body> <h1 align="center"><font color="#000080">Ajax
displaying data
displaying data   how to display data from database on jsp using struts2
Ajax
options. I want to do it using ajax. My table is CREATE TABLE HT<em>
AJAX
ajax. My table is CREATE TABLE HTNEWMETER ( ID NUMBER (10) NOT NULL, METERNO
AJAX - Ajax
AJAX  what is Ajax?WHAT IS THE USAGE OF IT?WHERE WE HAVE TO USE IT? GIVE ME EXPLANATION WITH EXAMPLE?  Hi friend, Ajax : Asynchronous JavaScript and XML or Ajax for short is new web development technique used
Image is not displaying
Image is not displaying  Hii i am using spring javamail with html template to send mail,i am facing that image displaying prob when mail have to cm in gmail,in template just i am giving my current location of image which
AJAX - Ajax
AJAX  What is AJAX?how we will use it in java?what is the use of AJAX?give me example?   hi friend, Ajax plays a major role... characteristics have made it popular among the users to develop their site using Ajax
displaying image
displaying image  how to upload image and retrieve it form database mysql in php?   Here is an example of uploading image using php. 1)form.html: <form method="post" enctype="multipart/form-data" action="upload.php
ajax - Ajax
ajax  Hi all, I want ajax validation in struts1.0 , I tried from many days but, i cound't find solution.. I am attaching my code here. struts... ("Your browser does not support Ajax HTTP"); return; } var s
ajax - Ajax
ajax  Dear Roseindia, I want small application using ajax validation in struts1 login. I tried from many days but, i coudn't get solution..Do some favour me..it's urgent. Thanqs for advance.   Hi
Ajax - Ajax
that : form1.html where all Ajax code is written : function showHint...){ alert ("Your browser does not support AJAX!"); return
AJAX - Ajax
("Your browser does not support AJAX!"); return; } var url="http://localhost
PHP Displaying URL Content
PHP Displaying URL Content  In my PHP application form, on submitting the form details it always displaying url content. Can anyone tell me what is the reason and how to restrict it from displaying
codes for displaying in calendar
codes for displaying in calendar  can i get jsp codes for displaying comments, when the pointer is placed over the particular date in calendar
AJAX with
AJAX with       Ajax resources, in a digg style, allows the user to register and addd his/her own links Read full DescriptionADS_TO_REPLACE_1
Displaying images - JDBC
Displaying images  How to display multiple images on a single jsp from MySql database
Displaying images - JDBC
Displaying images  How to display multiple images on a single jsp from MySql database
image displaying in java
image displaying in java  how to display an image by using load image button in applet viewer
What is ajax? - Ajax
What is ajax?  What is Ajax Programming? Can any one share the basic examples of it? thanks
(Displaying a calendar in GUI
(Displaying a calendar in GUI  (Displaying a calendar) Write a program that displays the calendar for the current month, as Use labels, and set texts on the labels to display the calendar."The Calendar and GregorianCalendar
Ajax Learner - Ajax
Ajax Learner  Hi, This is Ziaul,I am working as Java/j2ee Developer from last one year. i have to use Ajax for my current project.pls guide me how should i proceed to learn Ajax. Thanks and Regards Ziaul Hauqe Siddique 
Ajax validation - Ajax
Ajax validation  how to validate a form using Ajax and php  ... you. Please visit for more informaton: http://www.roseindia.net/ajax/ajaxlogin/ajax-registration-program.shtml Thanks. Amardeep
Ajax Learner - Ajax
Ajax Learner  Hi, This is Ziaul,I am working as Java/j2ee Developer from last one year. i have to use Ajax for my current project.pls guide me how should i proceed to learn Ajax. Thanks and Regards Ziaul Hauqe Siddique 
autocomplete displaying multiple fields
autocomplete displaying multiple fields  How can I create an autocomplete with three field (name, id, phone). Placing the phone field in the appropriate input field but selecting the name field into the 'calling' input box
ajax basics - Ajax
ajax basics  i need ajax basics where can i find these........................ pls help me thanx in advance  Hi friend, Ajax : Asynchronous JavaScript and XML or Ajax for short is new web development technique
Ajax form element - Ajax
Ajax form element  I have problem in passing a value into form feild using ajax. I want to get the value is as a parameter. Can some one help me plz
ajax in java - Ajax
ajax in java  Dear deepak sir, My page contain several control... will come "Caseno exist" Sir I am using Ajax first-time.Please help me.   Hi friend, Ajax : Asynchronous JavaScript and XML or Ajax for short
ajax with php - Ajax
ajax with php  how to do autocomplete search using ajax wit php in object oriented format?.. data should me retrive from database.. plz the way?.. give some sample codings
xml displaying a drives data.....
xml displaying a drives data.....  Hi all, I need a solution for displaying content of a drive(Ex: c , d , e ) in the browser using the XML... all, I need a solution for displaying content of a drive(Ex: c , d , e
Ajax type
Ajax type  hiii, Is Ajax a technology platform or is it an architectural style
2 - Ajax
Is Ajax Synchronous or Asynchronous?  Can ajax synchronous or asynchronous? Why

Ads