aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes ajax issue 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 "ajax issue" Watch "ajax issue" New topic
Author

ajax issue

sunil clumpsy
Greenhorn

Joined: Apr 24, 2013
Posts: 2
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

Joined: Aug 16, 2005
Posts: 14352
    
  22

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
sunil clumpsy
Greenhorn

Joined: Apr 24, 2013
Posts: 2
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 .....
 
Don't get me started about those stupid light bulbs.
 
subject: ajax issue