Here is the deal... I need to make an AJAX save script. I have a whole system built on php and every action needs a refresh... I'm trying to minimize the refresh count by using AJAX ... I can't seem to find a way how to send a WYSIWYG editor output without loss to the PHP script...
if (window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}
else{
xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
}
function save(){
xmlhttp.open('POST','action.php',true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", document.getElementById('output').value.length);
xmlhttp.setRequestHeader("Connection", "close");
xmlhttp.send(document.getElementById('output').value);
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState == 4 && xmlhttp.status==200){
$('#ajaxresult').css('opacity', 0.1);
$('#ajaxresult').stopAll().pause(1000).fadeTo(400,1);
$('#ajaxresult').stopAll().pause(3000).fadeTo(400,0, function(){$(this).hide();});
document.getElementById('ajaxresult').innerHTML=xmlhttp.responseText;
}
}
}
While this script works fine I can't seem to find the way what kind of array to give the send option... what is the syntax or is there something I don't know?
BTW I'm a beginner in JS...