2013-06-06 26 views
1

我有它下面的鏈接正常工作,但我只是想用Url.Content請指教,謝謝如何引用URL內容在MVC

$('#btnAddConsumer').click(function() { 
     window.open('/ProductDetails/AddNewProduct/', 'AddProduct', 'height=' + (window.screen.height - 470) + ',width=820,left=' + (window.screen.width - 5) + ',top=10,status=no,toolbar=no,resizable=yes,scrollbars=yes'); 
    }); 

回答

0

我想你需要UrlHelper的Action方法:

'#btnAddConsumer').click(function() { 
     window.open('@Url.Action("AddNewProduct", "ProductDetails")', 'AddProduct', 'height=' + (window.screen.height - 470) + ',width=820,left=' + (window.screen.width - 5) + ',top=10,status=no,toolbar=no,resizable=yes,scrollbars=yes'); 
    }); 
0

試試下面的代碼

$('#btnAddConsumer').click(function() { 
     window.open('@Url.Content("~/ProductDetails/AddNewProduct/")', 'AddProduct', 'height=' + (window.screen.height - 470) + ',width=820,left=' + (window.screen.width - 5) + ',top=10,status=no,toolbar=no,resizable=yes,scrollbars=yes'); 
    });