I am using CI3 for one of my application. I do have some api created which is using different domain than that of application.
$.ajax({
url: "http://www.example.com/restapi/index.php/api/user",
type: "GET",
data: {"user_id": user_id},
username: "****",
password: "****",
success: function(response){
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(textStatus, errorThrown);
},
xhrFields: { withCredentials: true }
});
When I call this api to get some data using jquery ajax I get error
NS_ERROR_DOM_BAD_URI: Access to restricted URI denied
so I get to know that due to different subdomain of my application and api I can not access it.
Is there any way to allow access to api of different subdomain. I am using authorization in API.
I don't want to call some php file in which I call that API using some php function, that make no sense. I want to call API directly.
Let me know way to do this and access API.