Issue
Hi how to refresh an html page upon successful submission? I've tried as follows, but its not working.
$scope.submit =function(){
data = {};
angular.extend(data, $scope.final_data);
angular.extend(data, { checks : $scope.final_data.checks });
$http.post('{% url 'submit' %}', data).success(
function(data){
alert('succesfully submitted');
$location.path('{% url 'orc_checkbinning' %}');
}).error(function(){
alert('not submitted');
})
};
Am using Django framework for my project. Any idea? Thanks in advance.
Solution
Definition and Usage The
reload()
method is used to reload the current document. Thereload()
method does the same as the reload button in your browser. By default, thereload()
method reloads the page from the cache, but you can force it to reload the page from the server by setting the forceGet parameter to true: location.reload(true).Use this updated code.
$scope.submit =function(){
data = {};
angular.extend(data, $scope.final_data);
angular.extend(data, { checks : $scope.final_data.checks });
$http.post('{% url 'submit' %}', data).success(
function(data){
alert('succesfully submitted');
$scope.reloadPage = function()
{
$window.location.reload();
}
}).error(function(){
alert('not submitted');
})
};
Answered By - Harish Verma
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.