1
我已經構建了一個Intranet ASP Razor MVC 4網站,其中包含許多使用JQuery的JavaScript函數。當網站公佈了奇怪的轉變與JavaScript的出現:ASP Razor MVC 4 Wierd Javascript格式
之前發佈:
$(function()
{
$("#btnSettings").click(function()
{
$("#dialog-Settings").dialog("open");
});
$("#dialog-Settings").dialog(
{
resizable: false,
height: 200,
width: 350,
modal: true,
autoOpen: false,
buttons:
{
"Save": function()
{
var server = $("#serverTitle-Name").text();
$.get(
'@Url.Action("SaveSettings")',
{ serverName: server },
function (responseText)
{
if (responseText.length > 4)
{
alert(responseText);
}
}
);
$(this).dialog("close");
},
Cancel: function()
{
$(this).dialog("close");
}
}
});
});
發佈(實際網站)後:
try{if(window.__vwd)__vwd.push(__vwdLid,"","",6672,110);$("#btnSettings").click(function()
{var __vwdLid=window.__vwd?++__vwd.nextSid:0;
try{if(window.__vwd)__vwd.push(__vwdLid,"","",6732,37);$("#dialog-Settings").dialog("open");}finally{if(window.__vwd)__vwd.pop();}
});}finally{if(window.__vwd)__vwd.pop();}
try{if(window.__vwd)__vwd.push(__vwdLid,"","",6794,980);$("#dialog-Settings").dialog(
{
resizable: false,
height: 200,
width: 350,
modal: true,
autoOpen: false,
buttons:
{
"Save": function()
{var __vwdLid=window.__vwd?++__vwd.nextSid:0;
var server = $("#serverTitle-Name").text();
try{if(window.__vwd)__vwd.push(__vwdLid,"","\"Save\"",7154,403);$.get(
'/Home/ResolveError',
{ serverName: server },
function (responseText)
{var __vwdLid=window.__vwd?++__vwd.nextSid:0;
try{if(window.__vwd)__vwd.push(__vwdLid,"","",7362,144);if (responseText.length > 4)
{
try{if(window.__vwd)__vwd.push(__vwdLid,"","",7455,20);alert(responseText);}finally{if(window.__vwd)__vwd.pop();}
}}finally{if(window.__vwd)__vwd.pop();}
}
);}finally{if(window.__vwd)__vwd.pop();}
try{if(window.__vwd)__vwd.push(__vwdLid,"","\"Save\"",7581,24);$(this).dialog("close");}finally{if(window.__vwd)__vwd.pop();}
},
Cancel: function()
{var __vwdLid=window.__vwd?++__vwd.nextSid:0;
try{if(window.__vwd)__vwd.push(__vwdLid,"","Cancel",7703,24);$(this).dialog("close");}finally{if(window.__vwd)__vwd.pop();}
}
}
});}finally{if(window.__vwd)__vwd.pop();}
爲什麼ASP轉化我的JavaScript這樣嗎?我該如何阻止它?
我沒有配置一個明確的ScriptBundle,但似乎因爲它是在默認情況下,這文章是正確的方向,謝謝! – tcables