jquery - Call a method from Servlet (Servlet MVC) using ajax call? -


the current jsp page called using below url request:

device/loan 

and when calling jquery.get url user/xyz instead of calling http://http://localhost:8080/springmvctest/user/xyz calling

http://localhost:8080/springmvctest/device/user/xyz

below javascript code:

$('#loanedto').blur(function () {     console.log("inside" + $('#loanedto').val().length);     if ($('#loanedto').val().length > 1) {         $.getjson("http://localhost:8080/springmvctest/user/badgeid", { "loginid": $('#loanedto').val() }, function (result) {             if (result === 'no record found') {                 alert('no record found.');             }             else {                 $('#xyz').val(result);             }          });     } }); 

sorry english.

you should not put absolute url ajax call relative one:

 $.getjson("user/badgeid") 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -