Javascript AngularJS$http参数
我正在尝试将angularJS应用程序连接到我创建的web服务。web服务有一个switch语句,它根据传递的参数选择正确的php文件。在本例中,我希望将操作、检索传递给web服务。如何使我的$http.get通过将由switch语句读取的参数 调用Web服务Javascript AngularJS$http参数,javascript,php,angularjs,web-services,hybrid-mobile-app,Javascript,Php,Angularjs,Web Services,Hybrid Mobile App,我正在尝试将angularJS应用程序连接到我创建的web服务。web服务有一个switch语句,它根据传递的参数选择正确的php文件。在本例中,我希望将操作、检索传递给web服务。如何使我的$http.get通过将由switch语句读取的参数 调用Web服务 function customersController($scope,$http) { $http.get("http://10.137.98.144") .success(function(response) {$scope.
function customersController($scope,$http) {
$http.get("http://10.137.98.144")
.success(function(response) {$scope.names = response;});
}
网络服务
switch ($_POST['action'])
{
case 'retrieve':
require "retrieve.php";
retrieve();
break;
}
您可以通过url传递参数 试试这个:
$http.get("http://10.137.98.144?action=retrieve")
在php中,可以将参数与
$param = $_GET('action');