Cross-Origin Request Blocked - Laravel

i have try to access(get request) my laravel api from ionic(angularjs) app. but it keep getting bellow error.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://128.xxx.xxx.xx/mobi/check/?username=achchu&apikey=1N7GyYRfq8bQnrFCCGgL

please help me to fix this

This response is based on the fact that it appears you have control of serve-side code. Have you added CORS support to the response? If you have not done so it could be like this.

You could add a handler thus:

Route::head("/<path to resource>", function () {
    $r = Response::make("hello");
    //Access-Control-Allow-Origin: http://api.bob.com
    // Access-Control-Allow-Credentials: true
    $r->header("Access-Control-Allow-Origin", "<*|client request domain>")
    ->("Access-Control-Allow-Credentials", "true")
    ->("Access-Control-Request-Method", "GET");

});

Perhaps you could set this headers on the response you are sending itself, I'm not sure. If that is possible and you might use this sort of thing on several routes it's better you prepare it as a filter. You can read more on CORS at http://www.html5rocks.com/en/tutorials/cors/ .

If what you want to send is json data think about serving your response to support jsonp. You could do something like:

   $normalData = Model::all();

   // if the client made a jsonp style request
   if (Input::has("callback")) {
        $data = "<script>" . Input::get("callback") . "(" . json_encode($normalData) . ")";
       return Response::make($data)->header("Content-Type", "appplication/javascript");
   }else {
       //if not then return normally
       return Response::json($normalData);
   }

You are trying to access api from one domain to a different domain. There are many ways to overcome this issue,but since it is a get Request,use **jsonp*.

Try something like this

   var url = ' http://128.xxx.xxx.xx/mobi/check/?username=achchu&apikey=1N7GyYRfq8bQnrFCCGgL&callback=JSON_CALLBACK';
                $http.jsonp(url)
                .success(function(data) {

                });