I have access to a API which is a JSP file and is in JSON format. I am trying to fetch those data from the JSP page to a PHP script and process them and then store in my MySQL sever.
The JSON string is valid in the JSP page I checked in few JSON Formatter and validator online.
This is my code which I am using to get JSON data from the page but, every time my ajax call fails.
$('#button').click(function(e){
var url = 'http://xxxxx:8080/StudentAPI/index.jsp';
$.ajax({
url : url,
dataType : 'json',
success : function(response) {
alert('Success');
},
error : function(request, textStatus, errorThrown) {
alert(request+textStatus+errorThrown);
}
});
e.preventDefault();
})
Please help me and any suggestion to do it in a better way is always welcomed.