Hi
I am using ajax to submit the request and then getting the response back to display contents of a div.
this is my code.
function showDiv(setname,url) {
if (window.XMLHttpRequest){ // if Mozilla, Safari etc
page_request = new XMLHttpRequest();
}
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e1){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e1){}
}
}
else
return false;
page_request.onreadystatechange = function(){ callback(page_request)};
page_request.open('GET',url, true);
page_request.send(null);
}
function callback(page_request)
{
if (page_request.readyState == 4) {
if (page_request.status == 200) {
document.getElementById("setaffiiates").innerHTML = page_request.responseText;
document.getElementById("setaffiiates").style.display = "block";
}
}
}
my div code is
<div id="setaffiiates" style="display:none;position: absolute; padding:2px; width: 225px; z-index: 500;">
<% NetworkSet[] netSets = (NetworkSet[])request.getAttribute("netSets"); %>
<table>
<tr>
<td>
<%=netSets[0].network%>
</td>
</tr>
</table>
</div>
Pl excuse if I have mixed the JSP code there. But I have to show all the code for clarity. Now the issue when i get the reponse I see the whole html page again with the div portion again. So it is like the page and again page with div code.
What should I do if I want to get the div area and not the whole page once more again
thanks
Meena
I am using ajax to submit the request and then getting the response back to display contents of a div.
this is my code.
function showDiv(setname,url) {
if (window.XMLHttpRequest){ // if Mozilla, Safari etc
page_request = new XMLHttpRequest();
}
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e1){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e1){}
}
}
else
return false;
page_request.onreadystatechange = function(){ callback(page_request)};
page_request.open('GET',url, true);
page_request.send(null);
}
function callback(page_request)
{
if (page_request.readyState == 4) {
if (page_request.status == 200) {
document.getElementById("setaffiiates").innerHTML = page_request.responseText;
document.getElementById("setaffiiates").style.display = "block";
}
}
}
my div code is
<div id="setaffiiates" style="display:none;position: absolute; padding:2px; width: 225px; z-index: 500;">
<% NetworkSet[] netSets = (NetworkSet[])request.getAttribute("netSets"); %>
<table>
<tr>
<td>
<%=netSets[0].network%>
</td>
</tr>
</table>
</div>
Pl excuse if I have mixed the JSP code there. But I have to show all the code for clarity. Now the issue when i get the reponse I see the whole html page again with the div portion again. So it is like the page and again page with div code.
What should I do if I want to get the div area and not the whole page once more again
thanks
Meena