wood burning stoves 2.0*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 14074
    
  16

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 7 API documentation
Scala Notes - My blog about Scala
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 .....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ajax issue
 
Similar Threads
How to display value in combo box using AJAX
Regading getElementById
Filter Option on drop down menu
Can AJAX helps me to do that
problem with sending # character through ajax