Jump to content

viswa46

Members
  • Content count

    8
  • Joined

  • Last visited

Community Reputation

0 Neutral

About viswa46

  • Rank
    Newbie
  1. CSS Layout

    Hi, I'm new to css need to design a layout where at the center of the window website content should be present and on left and right of the space should be left(which is normally across the websites). Can you please guide me here!! Thanks in advance!!
  2. Read More Link

    Hi Everyone, I've use case lets us say in a paragraph i've 100 lines i need to display first 50 lines and other 50 lines should not be displayed.But when i click on Read More link all the lines should be displayed(100 lines). When the 100 lines are displayed then the close link should be enabled and when i click on the link 50 lines should be displyed. Thanks in advance!!
  3. Ajax XML Response - Undefined

    Hi, Thanks for the suggestion the console.log done the trick for me it helped to debug the responseXML. document.getElementById("textDisplay").value=xmlhttp.responseXML.docElement.childNodes[0].text // It works Thanks again!!
  4. Ajax XML Response - Undefined

    PFA Image
  5. Ajax XML Response - Undefined

    Hi, I'm not aware of which responseFromServer node can you please elaborate here please. Thanks, Viswa
  6. Ajax XML Response - Undefined

    Hi , Please find the below snippet <script type="text/javascript"> var xmlhttp; if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else if (window.ActiveXObject) { isIE = true; xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } function sendMessageToServer() { xmlhttp.open("POST","/LabAjax04/AjaxDemoServlet?name="+document.getElementById("inputDisplay").value,true); xmlhttp.onreadystatechange=receiveMessageFromServer; xmlhttp.send(); document.getElementById("inputDisplay").value=''; } function receiveMessageFromServer() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { alert(xmlhttp.responseXML.getElementsByTagName("responseFromServer")[0].text);// displays undefined alert(xmlhttp.responseText);//display the response from server document.getElementById("textDisplay").value=xmlhttp.responseXML.getElementsByTagName("responseFromServer")[0].text; } } Thanks, Viswa
  7. Ajax XML Response - Undefined

    Hi EveryOne, In the below snippet is there any syntaxt error or is there a better way to parse the xml doc. alert(xmlhttp.responseXML.getElementsByTagName("responseFromServer")[0].text);// displays undefined alert(xmlhttp.responseText);//display the response from server document.getElementById("textDisplay").value=xmlhttp.responseXML.getElementsByTagName("responseFromServer")[0].text; Regards, Viswa
  8. Ajax XML Response - Undefined

    Hi All, i'm doing sample ajax exercise and getting the response from server but the response work fine in IE browser but not in firefox/chrome browser. below is the code snippet also find the snippet ========================= ajaxdemo.html =========================l <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <input type="text" id="inputDisplay" /> <button type="button" onclick="sendMessageToServer()">Send To Server</button><br/> <input type="text" id="textDisplay"/> <script type="text/javascript"> var xmlhttp; if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else if (window.ActiveXObject) { isIE = true; xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } function sendMessageToServer() { xmlhttp.open("POST","/LabAjax04/AjaxDemoServlet?name="+document.getElementById("inputDisplay").value,true); xmlhttp.onreadystatechange=receiveMessageFromServer; xmlhttp.send(); document.getElementById("inputDisplay").value=''; } function receiveMessageFromServer() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { alert(xmlhttp.responseXML.getElementsByTagName("responseFromServer")[0].text);// displays undefined alert(xmlhttp.responseText);//display the response from server document.getElementById("textDisplay").value=xmlhttp.responseXML.getElementsByTagName("responseFromServer")[0].text; } } </script> </body> </html> ======================= java file ====================== package com.sample.ajax; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class AjaxDemoServlet */ public class AjaxDemoServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public AjaxDemoServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {} /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("server recived the folwwoing messgae from client:"+request.getParameter("name")); response.setContentType("text/xml"); response.getWriter().println("<responseFromServer>"+request.getParameter("name")+"</responseFromServer>"); System.out.println("server replied with the folwwoing messgae to client:"+request.getParameter("name")); } } ========= web.xml ========= <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>LabAjax04</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <servlet> <description></description> <display-name>AjaxDemoServlet</display-name> <servlet-name>AjaxDemoServlet</servlet-name> <servlet-class>com.sample.ajax.AjaxDemoServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>AjaxDemoServlet</servlet-name> <url-pattern>/AjaxDemoServlet</url-pattern> </servlet-mapping> </web-app> Thanks in advance!!!
×