Hi,
I can not solve a problem with FCKEditor and AJAX.
As far as now, FCE works great with writeing, editing but the problem shows up during sending data from the form throught AJAX. It semms that every time there is a "&" on the way in the html code, AJAX cut the rest of the code?
I used a "htmlspecialchars" function but it doesn't work as well.
Has anyone ever had this problem?
Colud you please give me some ideas to solve that?
Thanks in advance
That's my ajax js file:
var http_request = false;
function makePOSTRequest(url, parameters) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
// set type accordingly to anticipated content type
//http_request.overrideMimeType('text/xml');
http_request.overrideMimeType('text/html');
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Cannot create XMLHTTP instance');
return false;
}
http_request.onreadystatechange = alertContents;
http_request.open('POST', url, true);
http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http_request.setRequestHeader("Content-length", parameters.length);
http_request.setRequestHeader("Connection", "close");
http_request.send(parameters);
}
function alertContents() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
//alert(http_request.responseText);
result = http_request.responseText;
document.getElementById('admlinkcontainer').innerHTML = result;
} else {
alert('There was a problem with the request.');
}
}
}
function get(obj) {
var poststr = "input1=" + encodeURI( document.getElementById("input1").value ) +
"&co=" + encodeURI( document.getElementById("co").value );
makePOSTRequest('admPokaz.php', poststr);
}
and FCKEditor usage:
<form action="javascript:get(document.getElementById('myform'));" name="myform" id="myform">
<? include("/fckeditor/fckeditor.php") ; $oFCKeditor = new FCKeditor('input1') ; $oFCKeditor -> BasePath = '/fckeditor/'; $oFCKeditor -> Value = 'Default text in editor'; $oFCKeditor -> Create() ; ?>
<input type="hidden" name="co" value="<?echo $kategoria?>" id="co">
<input type="submit" name="button" value="Normal Submit Button">
?>
</form>
RE: Sending form with AJAX - ampersand proble
See http://sourceforge.net/forum/message.php?msg_id=4077481
Re: Sending form with AJAX - ampersand problem
"Error
Permission Denied
Access to this page is restricted (either to project members or to project administrators) and you do not meet the requirements to access this page. Please contact the administrator of this project for further assistance."