I have a jsp page which simply prints {"result" : "success"} and there is a php page which calls this jsp with JQUery AJAJAX as below
$(document).ready(function (){
$.ajax({
url: 'index.jsp',
data: 'id=test',
dataType: 'json',
cache: false,
async:true,
success: function(data) {
alert(data);
},
error: function(xhr, ajaxOptions, thrownError) {
alert('Error ' + xhr.statusText + xhr.responseText);
}
});
});
If I put url in browser it works fine . But this ajax request always goes to error block .
Is there any argument in ajax call wrong ? I get alert 'Error ' no other resoibse text or error code.
I have another exactly same call from a jsp page which worked fine !