Advertisement
Guest User

Ajax-Angularjs-Nope

a guest
Jul 22nd, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function LoginCtrl($scope, $http){
  2.     $scope.panel = 1; //Panel home a 1
  3.  
  4.  
  5.     $scope.login = function(){
  6.         var LoginRO = {
  7.             email : $scope.email,
  8.             password : $scope.password
  9.         }
  10.         $scope.loader = true;
  11.         $.ajax({
  12.             type:"POST",
  13.             beforeSend: function (request)
  14.             {
  15.                 request.setRequestHeader("X-ApiKey", "MasterMarket2014");
  16.                 request.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
  17.             },
  18.             url: "http://82.245.28.34:8080/api/login",
  19.             dataType: "json",
  20.             data: JSON.stringify(LoginRO),
  21.             success: function() {
  22.                 alert("Oh ouiiiiiii ! Enfin c'est magnifique ! Bon ce soir on fais la fête yepa youhou ! ");
  23.             }, error: function(){
  24.                 alert("Ma va fancullo ! ");
  25.             }
  26.         });
  27.         }
  28.  
  29.         httpSuccess = function(response){
  30.  
  31.             $scope.panel = 1;
  32.             $scope.loader = false;
  33.             alert("Bravo connard !")
  34.         }
  35.  
  36.         httpError = function(){
  37.             $scope.loader = false;
  38.             alert("Et bah non ça marche pas fils");
  39.         }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement