Ajax not processing when button is clicked

dadzr

New Member
So I am trying to use a simple Ajax function in a JSP using the JQueryUI. I am simply passing in two text fields that are used in a form, and trying to populate two divs with them. Nothing is happening at all when I click the button, I have tried putting console.logs in the ajax function and nothing is getting printed. JSP code for button click call (full jquery as requested)\[code\] $('#saveBtn').click(function() { //define the handler function for click event inline (it doesn't need a name because we're just using it one time) // get the value of the search box console.log("you are in the ajax"); var addressValue = http://stackoverflow.com/questions/15457600/$("#address").val(); var creditValue = http://stackoverflow.com/questions/15457600/$('#creditcard').val(); System.out.println("you are in the function"); // send to the server (this is relative to our current page) $.ajax({ url: "actions.InfoAjax.action", data: { // this is an embedded JSON object we'll send to server address: addressValue, creditcard: creditValue }, dataType: 'json', // tell JQuery to expect JSON back from the server success: function(ret) { // this is called as soon as the server returns console.log(ret.address); console.log(ret.creditcard); $('#savedAddress').html(ret.address); $('#savedCC').html(ret.creditcard); }//success });//ajax});//click\[/code\]});//readyHere is my html:\[code\]<form action="post"> <input type = "text" name="address" placeholder="Address" ></input></br> <input type = "text" name="creditcard" placeholder="Credit Card Number"> </input></br> <button type ="button" class ="btn btn-small" id="saveBtn">Save</button> </form>\[/code\]I have been trying to get this to work for hours, any help is appreciated.Here are the errors i'm getting from the console:\[code\] readyState: 4responseText: "??{? "address": [null],? "creditcard": [ test ]?}??"1: "parsererror"2: SyntaxErrorget stack: function () { [native code] }message: "Unexpected token e"set stack: function () { [native code] }__proto__: Errorcallee: function () {length: 3__proto__: Object\[/code\]
 
Back
Top