我想从JQuery函数中捕获变量的值,该函数通过单击网页的botton隐式调用。
function onclick()
{
DoPreview()
}
'************
function DoPreview()
{
var url = "";
var draftView = false;
var newEmaeaApconfig = false;
if ($("input[name$=rbtnlstGridCustDraft]:visible:checked").val() == 'Customer View')
draftView = false;
else {
draftView = true;
}
if ($("input[name$=rbtnlstforJPQ2C]:visible:checked").val() == 'New EMEA/AP Config')
newEmaeaApconfig = true;
else {
newEmaeaApconfig = false;
}
var role = $('[id$=ddlGridRolesPrvw]:visible').val();
var accessGrp = $('[id$=ddlGridUAG]:visible').val();
var params = "{ 'isDraftView': '" + draftView + "', 'isNewEmeaApConfig': '" + newEmaeaApconfig + "', 'accessGrpId': '" + accessGrp + "', 'roleId': '" + role + "' }";
jQuery.ajax({
url: 'Home.aspx/GetPagePreviewUrl',
type: "POST",
data: params,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
url = data.d;
window.open(url, '_blank');
//$("div[id$=pgprwGridModalpnl]:first").dialog("close");
$("div[id$=pgprwGridModalpnl]:visible").remove();
$("[id$=pgprwGridModalpnl]:visible").dialog("close");
return false;
}
});
}
这里我想使用VBA捕获“url”的值。 当我在按钮上执行点击事件时,DoPreview()会隐式调用并导航网址并立即重定向,因此我无法通过“LocationUrl”捕获它 提前谢谢。