我使用Cl編輯器在Cms上工作,每次我通過ajax提交數據我有問題。問題通過Ajax提交wysiwyg數據
假設我在我的wysiwyg編輯器中編寫了10行,但我只在php中接收3或4,在firebug中進行了一些調試之後我注意到了我通過ajax發送的html包含類「蘋果轉換「空格」<span class="Apple-converted-space"> </span>
我能夠在此跨度之前獲得所有內容,但是此跨度後的文本缺失。我不知道它是什麼。讓我寫我的代碼以便更好地理解。
要獲得cleditor數據
var data = $(".cleditorMain iframe").contents().find('body').html();
Ajax的表單提交
if(window.XMLHttpRequest)
{
xmlhttp = new window.XMLHttpRequest();
}
else
{
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
}
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == '4' && xmlhttp.status == '200')
{
}
}
parameters = 'data=' + data
xmlhttp.open('POST', 'libs/make_procedure.php', true);
xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xmlhttp.send(parameters);
return true;
我也曾嘗試jQuery的AJAX方法..存在同樣的問題存在,所以請不要問我使用其他方式通過ajax提交數據。
感謝
'onreadystatechange'看起來很破,什麼是該做的代碼? – leppie 2012-04-03 06:43:10
@leppie onreadystatechange是用於響應,我並不擔心這個問題..問題是我通過ajax發送的數據正在以類「Apple轉換空間」 – 2012-04-03 06:48:30