This is my Server side coding on to the JSP
<html>
<head>
</head>
<%
int number = 10;
out.println("The Returned response as per the hardcoded values is "+number);
%>
</html>
As you can see that , i am returrning an number as the response for an AJAX call
And on to the Script.js file , i am handling it in this way :
$.ajax({
type : "post",
url : "calculate.jsp",
dataType: "html",
success : function(msg) {
var pinNumber = msg;
alert(pinNumber);
}
});
As a result of this , i am getting the whole HTMl content as response as shown in the figure
http://tinypic.com/view.php?pic=vy431w&s=5
That’s normal, because you also included some HTML code:
Remove the HTML tags and it will work. Afaik, the JS works as intended.