方法一:利用a链接的target属性
html代码:
<div id="boxId">sdsafsdf</div><a id="linkA" target="_blank" style="display:none"></a>
js代码:
$("#boxId").bind("click", function(){
$.ajax({
url:"url",
type: 'GET',
dataType: 'text',
async:false,
success: function(xml)
{
document.getElementById("linkA").setAttribute("href", "http://www.baidu.com/");
document.getElementById("linkA").click();
}
});
});
方法二:利用window.open()
html代码:
<div id="boxId">sdsafsdf</div>
js代码:
$("#boxId").bind("click", function(){
$.ajax({
url:"url",
type: 'GET',
dataType: 'text',
async:false,
success: function(xml)
{
window.open("http://www.baidu.com/");
}
});
});