我有以下JavaScript從某處獲取HTML並將其粘貼在tinymce的textarea中。asp.net-mvc是否有可能獲取ViewData並將其粘貼在JavaScript函數中
我的問題是如何在asp.net-mvc我可以得到這裏的HTML並將其粘貼在JavaScript?
我把它放在ViewData中嗎?
function ajaxLoad() {
var ed = tinyMCE.get('elm1');
// Do you ajax call here, window.setTimeout fakes ajax call
ed.setProgressState(1); // Show progress
window.setTimeout(function() {
ed.setProgressState(0); // Hide progress
ed.setContent('HTML Here');
}, 500);
}
我想有這樣的事情下文,但它似乎並沒有工作:
function ajaxLoad() {
var ed = tinyMCE.get('elm1');
// Do you ajax call here, window.setTimeout fakes ajax call
ed.setProgressState(1); // Show progress
window.setTimeout(function() {
ed.setProgressState(0); // Hide progress
ed.setContent(<% ViewData["test"] %>);
}, 500);
}
視覺工作室似乎沒有認識到這一點。或者至少給我黃色突出顯示 – leora 2009-08-04 03:26:49