在使用angular发送ajax的时候get和post一样的,就是method改一下。

       ajax的js:

 1      <script>
 2        var app = angular.module('emialVerfiy',[]);
 3        app.controller('ev',function($scope,$http){
 4            $scope.send = function(){
 5                
 6                $http({
 7                    method:'get',
 8                    url:'../mailVerfiy/verfiy', 
 9                    contentType:'application/json;charset=UTF-8',
10                    params : {
11                        'mial' : $scope.show
12                        }
13                }).then(function successCallback (rs){
14                    $scope.show = rs.data;
15                });   
16            }
17        });
18     </script>

 

  后台接收:

1     @RequestMapping(value="/verfiy", method=RequestMethod.GET)
2     @ResponseBody
3     public String verfiy(@RequestParam(value="mial", required=true) String mail)
4     {
5         mailVerService.sendMail(mail);
6         return "发送成功,请去邮箱验证。";
7     }

 

  ps:

   要是遇到

     Status Code:400 Required String parameter 'mail' is not present 

   这种错误的话,应该是参数传入的格式有问题,接受不到造成的。

 

相关文章:

  • 2021-11-23
  • 2021-11-23
  • 2021-12-26
  • 2021-08-09
  • 2022-02-08
  • 2021-11-14
  • 2021-12-01
  • 2022-12-23
猜你喜欢
  • 2021-11-23
  • 2021-06-20
  • 2022-02-26
  • 2022-12-23
  • 2021-11-23
相关资源
相似解决方案