1

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.

However, I get and Asp.Net Error as follows:

**Server Error in '/' Application.

The resource cannot be found. Requested URL: /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;
   });
});

3
  • what do you get on the line window.open if you replace the ',' with +? Commented Oct 24, 2013 at 15:13
  • If I add url + "Index" + setting i get Requested URL: /Home/[object Object]/Indexheight=540,width=960,top=380,left=1520,scrollbars=yes,resizable=yes,toolbar=no,status=no,menu=no, directories=no,titlebar=no,location=no,addressbar=no If I add url + "Index" , setting /Home/[object Object]/Index Commented Oct 24, 2013 at 15:19
  • 1
    Your code above will set the title of the window to be '/Index' I'm assuming that's what you want for the title... if that is supposed to be appended to the url then you should put a + there... however... you still need to fix the url to concatenate a valid url instead of the javascript object. Commented Oct 24, 2013 at 15:23

1 Answer 1

1

Your code above will set the title of the window to be '/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. 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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.