| Author |
is that any sample code for Ajax which implement in jsp ?
|
Nakata kokuyo
Ranch Hand
Joined: Apr 13, 2005
Posts: 437
|
|
hi, good day, is there any simple sample code for ajax implementation in java environment ? for example, checking existing product code in database thank you
|
 |
Surya Kant
Ranch Hand
Joined: Mar 29, 2005
Posts: 104
|
|
Hope this would help you... function validate(url) { if (window.ActiveXObject) { request = new ActiveXObject("Microsoft.XMLHTTP"); request.onreadystatechange = checkForResult; if(request) { request.open("GET", url); request.send(); } } } function checkForResult() { // If req shows "loaded" if (request.readyState == 4) { // if response is "OK" if (request.status == 200) { //this is a response sent from server program //get this reponse & do the operations accordingly var response = request.responseText; } // Server not responding . It might have been stopped else { //stopScripts('Server not Responding'); } } } function setURL() { if(validatePass()) { var url = form some url which u want send to server validate(url); } }
|
 |
Gerardo Tasistro
Ranch Hand
Joined: Feb 08, 2005
Posts: 362
|
|
Try DWR http://getahead.ltd.uk/dwr Very easy to use. You just include the libraries as explained, setup some classes in your server and do some configuration. In a few minutes you'll be able to call your classes' methods from JavaScript. See this http://getahead.ltd.uk/dwr/examples/address
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
surya mm, your code is IE only......better make it work with all browsers! Eric
|
 |
Nakata kokuyo
Ranch Hand
Joined: Apr 13, 2005
Posts: 437
|
|
thanks all for warm reply and guidance
|
 |
 |
|
|
subject: is that any sample code for Ajax which implement in jsp ?
|
|
|