I have access to the API, which is a JSP file and is in JSON format. I am trying to extract this data from a JSP page in a PHP script and process it and then save it in my MySQL server.
The JSON string is valid on the JSP page that I checked in several JSON formatters and an online validator.
This is my code that I use 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 make it better is always welcome.
source
share