Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Usign Ajax

843833Dec 1 2008 — edited Dec 5 2008
Hell guys,
I am developing an application in which I needed to use Ajax. By the help of internet I implemented it but still having some problem with it,
My code is as below::

<script language="javascript">
function postRequest(strURL)
{

var xmlHttp;

if(window.XMLHttpRequest)
{ // For Mozilla, Safari, ...
var xmlHttp = new XMLHttpRequest();
}

else if(window.ActiveXObject)
{ // For Internet Explorer
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)
{

var temp = str.split(":");
var pass = document.getElementById("subject");
//Logic was here.
}
function call_register()
{
var selectedcourse = window.document.frm.course.value;
//alert(selectedsubject);
var url = "Servlet?" + selectedcourse;
postRequest(url);
}

now I was used to call the function call_register() and the updation to the page were done by the function updatepage(str).

The code is working nicely. But the problem is I dont know that from where the function updatepage() is being called?

Please do reply me.

Hirav
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 2 2009
Added on Dec 1 2008
2 comments
148 views