• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ajax issue

 
sunil clumpsy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
function showData() {
xmlHttp = GetXmlHttpObject();
//xmlHttp = XMLHttpRequest();
var url = "http://localhost:8080/SessionExam1/value.jsp";
var str="y";
url += "?count=" +str;
xmlHttp.onreadystatechange = stateChanged
xmlHttp.open("GET", url, true)
xmlHttp.send(null)
}
function stateChanged() {
if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
var showdata = xmlHttp.responseText;
document.getElementById("country").value = showdata;
}
}

function GetXmlHttpObject() {
var xmlHttp = null;
try {
xmlHttp = new XMLHttpRequest();
} catch (e) {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}


<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>







<%
response.setHeader( "Pragma", "no-cache" );
response.setHeader( "Cache-Control", "no-cache" );
response.setDateHeader( "Expires", 0 );

%>
<%
String url="";
String mapId="y";
%>
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15219
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

If you want help with your problem, you'd better explain what exactly the problem is; don't just dump some code and make people guess what your question is about.
 
sunil clumpsy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the below code is getting the response from another jsp page ....the problem is ...response containing html tags also....i have to remove that tags comming on response and i have to save it to the variable...and i have to use that variable in my jsp scriptlet variable....please help me .....thanks in advance...



function showData() {
xmlHttp = GetXmlHttpObject();
//xmlHttp = XMLHttpRequest();
var url = "a.jsp";
var str="y";
url += "?count=" +str;
xmlHttp.onreadystatechange = stateChanged
xmlHttp.open("GET", url, true)
xmlHttp.send(null)
}
function stateChanged() {
if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
var showdata = xmlHttp.responseText;
document.getElementById("country").value = showdata;
}
}

function GetXmlHttpObject() {
var xmlHttp = null;
try {
xmlHttp = new XMLHttpRequest();
} catch (e) {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}

a.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%
String count=request.getPrameter("count");
String buffer="";
if(count!=null){
buffer="Success";
}else
{
buffer="failure";
}
//for getting response back to ajax call
out.println(buffer);
%>



please help me .....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic