嗨,如何在成功提交后刷新 html 页面? 我试过如下,但它不工作。
$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');
})
};
我正在为我的项目使用 Django 框架。任何想法?提前致谢。
最佳答案
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');
})
};
关于javascript - 如何使用angularJS在成功提交后刷新页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33028720/