I am working with onkeydown events in order to get the written value (in a textarea), process it on a PHP file (passing it by Ajax post) and showing the result in an external div…
The problem is that each time I press the key, I can’t continue writing till Ajax does its task. How can I make it possible to keep writing even if the text hasn’t been processed yet?
—EDIT—
function fromWCtoHTML(source){
var act = new Date();
http[act] = createRequestObject();
http[act].open('post', '/php/fromWCtoHTML.php',false);
http[act].setRequestHeader('Content-Type','application/x-www-form-urlencoded',false);
http[act].send("source=" + source);
document.getElementById('AJAXWCtoHTML').innerHTML=http[act].responseText;
}
http[act].open('post', '/php/fromWCtoHTML.php',false);The 3rd parameter[
false] is causing your request to be synchronous.Change it to
trueor do not include it.EDIT Response for the comment stating that http[act].responseText is blank.
Add an
onreadystateevent handler. Try the following code