<html>
<body>
<form action="login.do" method="post">
//.....
<input type="submit" value ="send">
</form>
</body>
</html>
In my servlet I will be handle the request and send the json response back.
How can I get the json object from the response ?
But we can do this by calling a function when we click the button.
function(){
$ajax(
url:"login.do"
success: function(data){
//.....
}
)
}
is there any way to do this? Or only using the function call we can do it?
first argument of success callback that you call
datais the json object so long as you includedataType:'json'in ajax options or use shorthand$.post(url[,data][,function(json){}),'json'])methodRead about success callback in $.ajax API :
http://api.jquery.com/jQuery.ajax/
EDIT: Using deffered method