AngularJS passing data to $http.get request

前端 未结 7 781
无人及你
无人及你 2020-11-22 13:01

I have a function which does a http POST request. The code is specified below. This works fine.

 $http({
   url: user.update_path, 
   method: \"POST\",
   d         


        
7条回答
  •  春和景丽
    2020-11-22 13:04

    You can even simply add the parameters to the end of the url:

    $http.get('path/to/script.php?param=hello').success(function(data) {
        alert(data);
    });
    

    Paired with script.php:

    
    

    Resulting in the following javascript alert:

    array(1) {  
        ["param"]=>  
        string(4) "hello"
    }
    

提交回复
热议问题