public function __construct()
{
parent::__construct();
$this->load->model('api_model');
$this->load->library('form_validation');
Header('Access-Control-Allow-Origin: *'); //for allow any domain, insecure
Header('Access-Control-Allow-Headers: *'); //for allow any headers, insecure
Header('Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE'); //method allowed
//Or
header('Access-Control-Allow-Origin: website_url');
header("Content-Type: application/json; charset=UTF-8");
Header('Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE'); //method allowed
}