Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes HTML, CSS and JavaScript and the fly likes how to use ajax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to use ajax" Watch "how to use ajax" New topic
Author

how to use ajax

shyamkumar bopannachengalaiah
Ranch Hand

Joined: Dec 30, 2008
Posts: 100


function ajaxfrmconfiginst(v1,v2,v3,v4,v5)
{
//alert("¤cy="+getValue(v6));
var address="FormNoConfigInst";

var data = "term="+getValue(v1)+"&invalidlogin="+getValue(v2)+"&frmstartno="+getValue(v3)+"&receiptno="+getValue(v4)+"¤cy="+getValue(v5);
//lert(data);
issueResultPost(address, data);
}


/*Ajax for form fields insert*/
function issueResultPost(address, data) {
//alert(address+""+data);
var request = getRequestObject();
request.onreadystatechange =function()
{issueResponseText(request); };
request.open("POST", address, true);
request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
//alert(data);
request.send(data);
}


function issueResponseText(request) {

if ((request.readyState == 4) && (request.status == 200)) {
var str=request.responseText;
alert(str);

}
}




function getRequestObject() {
if (window.ActiveXObject) {
return(new ActiveXObject("Microsoft.XMLHTTP"));
} else if (window.XMLHttpRequest) {
return(new XMLHttpRequest());
} else {
return(null);
}
}


function getValue(id) {
return(escape(document.getElementById(id).value));
}

try { console.log("Loading script");
} catch(e) { console = { log: function() {} }; }
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684

Use code tag when your question contains code.

read this Use Code Tags ..


Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

Please take the time to choose the correct forum for your posts. This forum is for questions on JSP. For more information, please read this.

This post has been moved to a more appropriate forum.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

Also what's your question? All you've done is to post unreadable code.
Himanshu Kansal
Ranch Hand

Joined: Jul 05, 2009
Posts: 257
After skimming through your code, which actually required a lot of effort, I could only see that you are using ajax already and that to pretty fine. If this is your code then please rephrase the question, else please quote the source and place your question clearly


Experience and talent are independent of age
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to use ajax
 
Similar Threads
return value???
File Upload Issues
Page is Not Refreshing as Expected
AJAX problem in Internet Explorer
read a text file display values in drop down menu