js 关闭子页面刷新父页面
父页面js:
function btnAdd_onclick() {
window.open("WareConfigDetail.aspx?id=1", "","height=600, width=650, top=100, left=200,z-look=yes,toolbar=yes, menubar=no, scrollbars=yes, resizable=yes ,alwaysRaised=yes,
location=no, status=yes" );
}
function refresh() //任意你想刷新时调用的方法
{
this.location = this.location;
}
子页面JS:
function Save()
{
// debugger;
var CheckVales='';
$("#DivContent").find('input').each(
function()
{
if(this.checked)
{
var Cvalue=$(this).val();
CheckVales+=Cvalue+',';
}
}
)
if(CheckVales=='')
{
alert('请选择商品!')
return;
}
var SearchType=$('#ddlSearchType').find('option:selected').val();
// $('#txtCValues').val(CheckVales);
// var getRandom = Math.floor(Math.random()*1000+1);
$.ajax({
url: "../../Ashx/Product/AddWareConfigDetail.ashx",
data:{SearchTypes:SearchType,CheckVale:CheckVales},
cache:false,
type: 'GET',
success: function(msg){
alert(msg);
window.opener.refresh();//重点就在这里刷新 //可以为任意你想刷新时调用的方法 确保函数父页面中存在,子页面能访问
window.focus();
window.opener=null;
window.close();
},
beforeSend:function()
{
$("#divWait").find("img").attr({src:"../../admin/images/loading1.gif",style:"display:block"});
$("#divWait").append("请等待......");
}
});
}