jquery ajax not Sending data back to JSP via Spring Controller -


i trying make ajax call java method (returns string) via spring mvc. javascript code below calls java method , prints expect eclipse console. trying output text mentioned on html page. problem neither success or error callback functions entered cannot information returned java method.

thanks in advance

$("#datebutton").click(function(e){              fromdate = $("input#fromdate").val();             todate = $("input#todate").val();             fromcurr = $("input#fromcurr").val();              tocurr = $("input#tocurr").val();              var datastring = "fromdate=" +fromdate+"&todate="+todate+"&fromcurr="+fromcurr+"&tocurr="+tocurr;             $.ajax({                 type: "post",                 url: "getdailyrates.html",                 data: datastring,                 datatype: "text",                 async: 'false',                 success: function(data, textstatus, jqxhr){                     alert("in success");                     $('#display').html("");                      $('#display').append(data);                 },                 error: function(){                     alert("error!");                 }             });            }); 

java method

@requestmapping(value = "/getdailyrates.html", method = requestmethod.post)     public string getdailyrates(httpservletrequest request, httpservletresponse response ) {          dailyratesquery dailyrate= new dailyratesquery();         string fromcurr= request.getparameter("fromcurr");         string tocurr= request.getparameter("tocurr");          string fromdate= request.getparameter("fromdate");          string todate=request.getparameter("todate");          dailyrate.setfromcurr(fromcurr);         dailyrate.settocurr(tocurr);         dailyrate.setfromdate(fromdate);         dailyrate.settodate(todate);           system.out.println("from currency: "+fromcurr+" currency: "+tocurr+                 " fromdate: "+fromdate+" todate: "+todate);           list<dailyrate> rates = jdbcratedao.getdailyrates(dailyrate);           system.out.println("before return new model");         system.out.println(rates.tostring());         return rates.get(0).tostring();      } 

update:

when click button javascript function mapped to, java method have posted called , generates correct output. no sending output jsp.


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -