I have a PHP file where we put ajax call refers below code, searchbtn
is the button id which is places on php page.
$('#searchbtn').click(function(){
$.ajax({
type: "Post",
url: "http://10.000.000.000:8080/testData/",
success: function (result) {
console.log('dfdf');
}
})
});
here we give a sample ip of java page.
here 'testData' is a controller of java page when we hit this URL below error comes.
XMLHttpRequest cannot load http://10.000.000.000:8080/testData/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
How to resolve this problem? Can we directly access java page? Is java page call simply or we use some other connection?