Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 72443

How to post/ update data to PHP in Angular JS 1.6.9?

$
0
0

My existing project ran on Angular JS 1.5.7, all the functionalities were working properly, but when I changed the version to 1.6.9, all the functionalities stopped working, then I had to replace the .success with .then, however, the post and update function isn't working. Angular JS 1.5

 $http.post(
                    "insert.php", {
                        'name': $scope.name,
                        'email': $scope.email,
                        'age': $scope.age,
                        'buttonName': $scope.buttonName,
                        'id': $scope.id
                    }
                ).success(function(data) { //this function works on Angular JS 1.4.8
                    alert(data);
                    $scope.name = null;
                    $scope.email = null;
                    $scope.age = null;
                    $scope.buttonName = "Insert";
                    $scope.show_data();


                });
                //alert('Data inserted');
                  $scope.IsVisible = $scope.IsVisible = true;
                  $scope.response_msg="Data Inserted";
            }

I tried to replace the .success with .then didn't worked. PHP code:

if(empty($info)){
}
else{
$emp_id=mysqli_real_escape_string($db,$info->id);
$emp_name=mysqli_real_escape_string($db,$info->name);
$emp_email=mysqli_real_escape_string($db,$info->email);
$emp_age=mysqli_real_escape_string($db,$info->age);
$button_name=$info->buttonName;

Viewing all articles
Browse latest Browse all 72443

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>