我送http
要求到我的服务器和响应是一个html:使用Javascript - 刷新当前标签与HTTP响应
<html>
<head>
<link rel = "stylesheet" type="text/css" href="CSS/jQUERYUI.css">
</head>
<body>
<div id = "first">
data : someData
</div>
</body>
</html>
我想当前页面将与响应数据刷新,所以我尝试:
$http({
method: 'POST',
url: '/someUrl'
}).then(function(response) {
var win = window.open(window.location.href, '_blank');
$(win.document.body).html(response.data)
}, function(error) {
});
还有一些使用js 535-ways-to-reload重新加载页面的535种方法。 我仍然无法使用响应html重新加载当前页面。
另外我希望当前页面的网址不会改变。 angularjs
这样做的方式也很棒。
感谢蚂蚁的帮助。
为什么您的服务器返回HTML? – Nicolas
您可能应该将响应数据存储在控制器的属性中,并使用ng-bind-html或者可能只是ng-bind-html将元素绑定到您的控制器函数。 –
@Nicolas - 它是在长时间的完成过程之后创建的。 –