2014-03-04 33 views
0
'use strict'; 

foodMeApp.controller('SearchController', function($scope, $http) { 
     $scope.url = '/server/api.php'; // The url of our search, some thing wrong here 
              
        // The function that will be executed on button click (ng-click="search()") 
        $scope.search = function() { 
              
            // Create the http post request 
            // the data holds the keywords 
            // The request is a JSON request. 
            $http.post($scope.url, { "data" : $scope.keywords}). 
            success(function(data, status) { 
               ... 
            }).error(function(data, status) { 
               ...   
            }); 
        }; 
}); 

這裏有什麼錯誤$ scope.url ='/server/api.php';

粘貼了目錄結構和錯誤,

enter image description here

瀏覽器錯誤: enter image description here

請讓我知道,如果需要更多的信息

+0

我想,你的服務器文件夾是不確定的,看到該文件夾​​ –

+0

在一些通知符號嘗試$ scope.url = '服務器/ api.php'; – BKM

回答

0

我想將你的server文件夾app目錄將解決此問題;)

+0

沒有朋友,仍然是「NetworkError:404 Not Found - http://foodme/server/api.php」。 :( –

+0

如果您嘗試手動訪問'foodme/server/api.php', –

+0

foodme/server/api.php,手動操作,沒有運氣 –

0

I think, your server folder is undefined, see some notification symbol in that folder

嘗試

$scope.url = 'server/api.php'; 

,或者嘗試

$scope.url = '../server/api.php'; 
+0

$ scope.url ='../server/api.php';看起來正確,但仍然無法正常工作。但是當我做'移動服務器到你的應用程序文件夾;)'通過Paul Rad我評論,它的工作。但爲什麼不是你的解決方案 –

相關問題