JQuery-JSP AJAX example not working

JQuery-JSP AJAX example not working

Hi, I while back ran you tutorial at http://www.roseindia.net/tutorial/jquery/jqSquareroot.html. I copied to code to my location and ran it locally. It worked fine.

When running my own development code (following your example (and by the way, thanks for helping me get started with AJAX)), I was able to get it working. Just recently, I have been working on some additional development code using AJAX and I was getting some strange results, where my success call back function was being passed a javascript object, not the data that I expect, which would have been a string.

I went back to the original example figuring I must be doing something wrong. I again copied your example and ran it on my PC. When I ran it, the results return from the example were:

Enter number: 3 "Calculate Square Root"

[object XMLDocument]

where "Enter number:" is the label, "3" is my entry, "Calculate Square Root" is the button and "[object XMLDocument]" are the results after clicking on the button.

The only change in the source code that was copied was that I changed the version of jquery to jquery-1.7.2.min.js.

My question:

Does your example work in your environment if you use a later version of jquery?

View Answers

September 26, 2014 at 3:54 PM

Duh!! Please ignore my question. It turns out I was trying to access the application through directory file access not through an HTTP server. It works fine for me.

Jim









Related Tutorials/Questions & Answers:
JQuery-JSP AJAX example not working
JQuery-JSP AJAX example not working  Hi, I while back ran you... started with AJAX)), I was able to get it working. Just recently, I have been working on some additional development code using AJAX and I was getting some
Ajax example
Ajax example   Hi, Where can I find Ajax example program? Thanks   Hi, Get it at: Ajax Tutorials First Ajax Example Ajax Login Example Thanks
Advertisements
ajax example
in jsp page?   Hi, Please read Ajax First Example - Print Date... ajax get example jQuery ajax get example  Hi, How I can use jQuery...Ajax Example Here is the list of few Ajax examples at RoseIndia.net. Ajax
Ajax not working in jsp
Ajax not working in jsp  I'm using Netbean, Ajax validation in the following code is not working the code succesfully run for first UID validation...; frmMain.elements[i].valid; } } return blnValid; } //if Ajax
window.open() not working - Ajax
is that the pop up window is not at all working.. Once I click the button, the page
jquery - JSP-Servlet
jquery with jsp. Please send the code for me immediately. Regards...://www.roseindia.net/ajax/jquery/ Hope that it will be helpful for you. Thanks...jquery  Hi, I need validation script for jquery. I have username
JDBCTemplate BatchUpdate() example not working
JDBCTemplate BatchUpdate() example not working  Hi, I tried the JDBCTemplate BatchUpdate example, with IBM DB2 database. I updated the dataSource bean values accordingly. When I try, the program runs fine, however the database
Struts 1.2 and ajax example
Struts 1.2 and ajax example  Struts 1.2 and ajax example with data from database
Working Example for Spring AOP - Spring
Working Example for Spring AOP  Hi All, I need a complete working Java example /Code/Logic for Spring -Aspect Oriented Programming. Code provided will be highly appreciated. -- Deepak Lal
Hibernate Basic Example not working
Hibernate Basic Example not working  I have implemented basic hibernate example from your site . In console i got output but database is not affected. hbm.xml <id name="id" type="long" column="id"> <generator
Ajax post example
Ajax post example  Hi, I am looking for ajax post example. Thanks   Hi, You can use jQuery to jQuery Post Data. Thanks
ajax login example
ajax login example  hi deepak, i am trying to execute ajax login example in eclipse but it show the form but when I enter admin admin it shows invalid credentials how to resolve
How to write first example in Ajax?
How to write first example in Ajax?  Hi, I am beginner in Ajax and want learn it. How can I write first example in Ajax? Thanks   Hi, Please check the tutorial First Ajax Example. Thank
DOJO HelloWorld Example - Ajax
DOJO HelloWorld Example  Hi I am total in using DOJO for AJAX purpose From the HellowWorld example Hello World! The Button has already the onClick the helloPressed() function directly. SO what and when exactly does
jQuery ajax get example
jQuery ajax get example  Hi, How I can use jQuery for get request? Give me code for jQuery ajax get request. Thanks
Ajax form validation Example
to validate form in Ajax using jQuery framework. Thanks...Ajax form validation Example  Hi, I want to validate my ajax form. Please give me good code for Ajax form validation. Thanks   Hi, Read
Ajax example doesn;t work - Ajax
Ajax example doesn;t work  Hello every one, I'm new to Ajax and was playing around with code in this link: http://www.roseindia.net/answers/viewanswers/1219.html It works but it doesn't printout the result to the user
How to use Jquery in jsp page
How to use Jquery in jsp page  Hello Sir, I am developing a web application in which i have to show database table values into Gridview in my jsp page. I have heard that jquery will be usefull for this work
AJAX Example
AJAX Example       In the following example we will see how to display server IP address dynamically with the help of AJAX, HTML, & PHP. SimpleAjax.htmlADS_TO_REPLACE_1 <html>
First Ajax Example
Ajax First Example - Print Date and Time   ... from scratch. This is the first example in Ajax that will give you quick start... and develop our fist Ajax Datetime example.  ADS_TO_REPLACE_2 Here is the code
query related to roseindia example - Ajax
query related to roseindia example  http://www.roseindia.net/ajax/File-Upload.shtml In FileUploadServlet.java where is "fileupload package" I am getting error on "import org.apache.commons.fileupload.disk.DiskFileItemFactory
Struts2 ajax validation example.
Struts2 ajax validation example. In this example, you will see how to validate login through Ajax in struts2.  1-index.jsp <html>ADS_TO_REPLACE_1 <head> <title>Ajax_Validation_Example</title> <
Display current time using jQuery & JSP
. In this example I am explaining about the use of jQuery in JSP page for getting...Display current time using jQuery & JSP In this Tutorial we will develop a Html page which displays current date and time using jQuery and JSP
Struts2.2.1 Ajax div tag example.
Struts2.2.1 Ajax div tag example. In this section, we will introduce you to about the Ajax div tag. The div tag when used with Ajax refreshes the content... <html>ADS_TO_REPLACE_1 <head><title>Ajax_Div_Tag_Example<
Java Example program to get the current working directory
Java Example program to get the current working directory       This example java program illustrates to get the current working directory (CWD). With the File class
select value from autocomplete textbox using jquery in jsp from database.
select value from autocomplete textbox using jquery in jsp from database.  Hii Sir, Lots of thnx to ur reply .I went through both... of selecting value from autocomplete textbox using jquery in jsp from mysql database
select value from autocomplete textbox using jquery in jsp from database.
select value from autocomplete textbox using jquery in jsp from database.  Sir, Lots of thnx to ur reply .I went through both the tutorials... autocomplete textbox using jquery in jsp from mysql database. Kindly send me
Ajax
Ajax  send the example to fetch the data from the server by using ajax in java. for ex:-if there are states which is used to display in frontend we use ajax. send it to me
Selecting value from autocomplete textbox using jquery in jsp
Selecting value from autocomplete textbox using jquery in jsp   hello Sir, I completed ur tutorial on autocompletion textbox from database using Jquery in jsp .It worked Fine .Thank you For Ur valuable Guidance .But it does
Ajax Example
Ajax Example
Ajax Example
Ajax
Ajax  how to include ajax in jsp page?   Hi, Please read Ajax First Example - Print Date and Time example.ADS_TO_REPLACE_1 Instead of using PHP you can write your code in JSP. Thanks
Struts 2.2.1 Ajax Tags And Example
Struts 2.2.1 Ajax Tags And Example a autocompleter bind datetimepicker div head submit tabbedpanel textarea tree treenode
Example of anchor(Ajax) in struts2.2.1
-style: italic; } Example of anchor(Ajax) in struts2.2.1 In this example, you will see the use of Ajax(anchor) tag.  Here, we are changing value of div tag with the help of Ajax anchor tag.   1- index.jspADS
Ajax
Ajax  How to learn AJAX
ajax
ajax  please describe the ajax
Ajax Examples
Ajax Examples         Displaying Time: This example is simple one to understand Ajax with JSP. The objective of the example is to display the current date
Ajax
Ajax  Hi, What is Ajax? What is the use of Ajax? Thanks   Hi, Ajax is set of technologies used to develop dynamic web applications. In Ajax following technologies is used: a) JavaScript b) XML c) HTTP d) CSS Learn
AJAX - Ajax
AJAX  what is Ajax?WHAT IS THE USAGE OF IT?WHERE WE HAVE TO USE IT? GIVE ME EXPLANATION WITH EXAMPLE?  Hi friend, Ajax : Asynchronous JavaScript and XML or Ajax for short is new web development technique used
Ajax
Ajax  how to impliment ajax in registration table using jsp-servlet
AJAX - Ajax
AJAX  What is AJAX?how we will use it in java?what is the use of AJAX?give me example?   hi friend, Ajax plays a major role... characteristics have made it popular among the users to develop their site using Ajax
ajax
;This very simple Ajax Example retrieves the current date and time from server...ajax  How can we fetch data in ajax through servlet?   "mainpage.jsp" <html> <head> <title>Ajax Example</title>
ajax
;This very simple Ajax Example retrieves the current date and time from server...ajax  How can we fetch data in ajax through servlet?   "mainpage.jsp" <html> <head> <title>Ajax Example</title>
ajax
;This very simple Ajax Example retrieves the current date and time from server...ajax  How can we fetch data in ajax through servlet?   "mainpage.jsp" <html> <head> <title>Ajax Example</title>
ajax
;This very simple Ajax Example retrieves the current date and time from server...ajax  How can we fetch data in ajax through servlet?   "mainpage.jsp" <html> <head> <title>Ajax Example</title>
ajax
ajax  how to connect ajax with mysql without using php,asp or any other scripting language. please answer soon
Simple Ajax Example, Developing Simple Ajax application
Simple Ajax Example       Simple Ajax Example In this tutorial we are going to develop a very simple Ajax Example. This simple Ajax example code will help you in understanding the core
Basics - Ajax
are working on it.Using Ajax you can show all the incoming data in the same frame...Basics  How Ajax works?  How Ajax works?Find out how Ajax works and how a developer can use it for developing web applications. Ajax
Ajax File Upload Example
Ajax File Upload Example      ... servlet through the Ajax technology. In this example you simply create a file Upload application using ajax just follows by these points:ADS_TO_REPLACE_1

Ads