gpt4 book ai didi

c# - JSON TinyMCE 返回值 "\t"

转载 作者:行者123 更新时间:2023-11-29 10:18:48 24 4
gpt4 key购买 nike

我应该为“streszczenie”使用另一个变量吗?或者我应该怎么做?

在我看来,TinyMCE 正文中有 html,但我只得到 "\t" 可能我遇到了 JS 问题

this is new problem - this question is related with this link. I added this for other users

这是我用TinyMCE写的

enter image description here

这是我从 TinyMCE textarea "streszczenie"得到的

enter image description here

如您所见,有文字 ghhfgh 但我无法获取此文字

enter image description here

现在我在执行 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 一直没有执行

enter image description here

当我点击按钮 tinyMCE.get('Streszczenie').getContent() 为空时,我检查了这个,但我不知道为什么,因为我已经将文本放入文本区域

<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>

最佳答案

您以错误的方式获取内容,而不是通过 jQuery 的 val()

要获取 tinymce 内容,只需使用 tinyMCE 对象引用:

// Get the HTML contents of the currently active editor
console.debug(tinyMCE.activeEditor.getContent());

// Get the raw contents of the currently active editor
tinyMCE.activeEditor.getContent({format : 'raw'});

// Get content of a specific editor:
tinyMCE.get('content id').getContent()

如前所述: http://www.tinymce.com/wiki.php/API3:method.tinymce.Editor.getContent

希望它有所帮助。波兰人:)

关于c# - JSON TinyMCE 返回值 "\t",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15598341/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com