【发布时间】:2013-03-13 23:05:47
【问题描述】:
我应该为“streszczenie”使用另一个变量吗?或者我该怎么办?
在我看来,TinyMCE 正文有 html,但我只得到 "\t" 可能我对 JS 有问题
this is new problem - this question is related with this link. I added this for other users
这是我在 TinyMCE 中编写的
这是我从 TinyMCE textarea "streszczenie" 得到的
如您所见,有文字 ghhfgh 但我无法获取此文字
现在我遇到了执行 JSON 的问题
<script type="text/javascript">
function Save() {
tinyMCE.triggerSave();
var Temat_controll = $('#Temat').val();
var Streszczenie_controll = tinyMCE.get('Streszczenie').getContent();
var PelnyOpis_controll = $('#PelnyOpis').text();
$.ajax({
url: '@Url.Action("DodajTematSave", "StronaGlowna")',
dataType: "json",
data: {
Temat: Temat_controll,
Streszczenie: Streszczenie_controll,
PelnyOpis: PelnyOpis_controll
},
type: "POST",
async: false,
error: function() {
},
success: function(data) {
if (data.Success) {
alert('success');
}
}
});
}
</script>
我明白了,但 JSON 一直没有执行
当我单击按钮 tinyMCE.get('Streszczenie').getContent() 为空时,我检查了这个,但我不知道为什么,因为我已将文本放入 textarea
<script type="text/javascript">
function Save() {
var Temat_controll = $('#Temat').val();
var $d = tinyMCE.get('Streszczenie').getContent();
if ($d.length != 0) {
if ($d.val().length != 0) {
var Streszczenie_controll = tinyMCE.get('Streszczenie').getContent();
}
else {
var Streszczenie_controll = 'ewewe';
}
}
var PelnyOpis_controll = $('#PelnyOpis').text();
$.ajax({
url: '@Url.Action("DodajTematSave", "StronaGlowna")',
dataType: "json",
data: {
Temat: Temat_controll,
Streszczenie: Streszczenie_controll,
PelnyOpis: PelnyOpis_controll
},
type: "POST",
async: false,
error: function () {
},
success: function (data) {
if (data.Success) {
alert('success');
}
}
});
}
</script>
【问题讨论】:
-
这个链接对于理解 JSON 问题也很有用[点击这里][1] [1]:stackoverflow.com/questions/15600396/json-data-html-parameter
标签: c# javascript asp.net-mvc json tinymce