Support the ongoing development of Laravel.io →
Input Blade Forms

Anyone who knows AngularJS AJAX HTTP calls, please look over my code. I am stuck in a problem. I tried very hard but couldn't figure it out.

SCRIPT ON VIEW PAGE

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js">
var app = angular.module('routes', []);
app.controller('routeCtrl', function($scope, $http)
{
        $scope.route={};
        $scope.submit = function()
        {
            $http.get("checkRoutes").success(function(response) 
            {
                $scope.successCheck = response.message;
            });
        }
</script>

CODING IN LARAVEL CONTROLLER FILE

$input = json_decode( file_get_contents("php://input") );
        $q=DB::select("SELECT * FROM route where PlateNumber='$input->plate'");
        if($q->rowCount()>0)
            echo "Already exists".
        $data["message"] = "Route already exists";
        echo json_encode($data);
Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.