[英]Javascript/Jquery pop-up window in Asp.Net MVC4
Below I have a "button" (just a span with an icon) that creates a pop-up view of a div in my application to allow users to compare information in seperate windows. 在下面,我有一个“按钮”(带有图标的跨度),可在我的应用程序中创建div的弹出视图,以允许用户在单独的窗口中比较信息。
However, I get and Asp.Net Error as follows: 但是,我得到和Asp.Net错误如下:
* *Server Error in '/' Application. * *“ /”应用程序中的服务器错误。
The resource cannot be found. 无法找到该资源。 Requested URL: /Home/[object Object] ** 要求的网址:/ Home / [object Object] **
Does anyone have an Idea of why this is happending? 有谁知道为什么会这样? Below is my code: 下面是我的代码:
<div class="module_actions">
<div class="actions">
<span class="icon-expand2 pop-out"></span>
</div>
</div>
<script>
$(document).ajaxSuccess(function () {
var Clone =
$(".pop-out").click(function () {
$(this).parents(".module").clone().appendTo("#NewWindow");
});
$(".pop-out").click(function popitup(url) {
LeftPosition = (screen.width) ? (screen.width - 400) / 1 : 0;
TopPosition = (screen.height) ? (screen.height - 700) / 1 : 0;
var sheight = (screen.height) * 0.5;
var swidth = (screen.width) * 0.5;
settings = 'height=' + sheight + ',width=' + swidth + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,resizable=yes,toolbar=no,status=no,menu=no, directories=no,titlebar=no,location=no,addressbar=no'
newwindow = window.open(url, '/Index', settings);
if (window.focus) { newwindow.focus() }
return false;
});
});
Your code above will set the title of the window to be '/Index'. 上面的代码会将窗口的标题设置为“ / Index”。 If you wanted that to be part of the URL you'll need to change that to a + to concatenate it to the url string. 如果您希望将其作为URL的一部分,则需要将其更改为+以将其连接到url字符串。 However you still have a problem with your url because wherever you are constructing your url you are appending an object rather than a string to the end of it. 但是,您的网址仍然存在问题,因为无论您在哪里构造网址,都将在其末尾附加一个对象而不是字符串。
[object Object]
Is how javascript concatenates an object onto a string and clearly based on the error message the window is requesting a malformed url. javascript是如何将对象连接到字符串上,并清楚地基于窗口请求格式错误的错误消息的错误消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.