Ciao devo inviare una query tramite AJAX,ma proprio non ci riesco 
Allora le pagina da considerare sono 3...
ajax.js che contiene il codice ajax
query.php che invia la query al database
index.php che è la pagina che ha il bottone per mandare la query
ajax.js
Codice PHP:
//creo l'oggetto XmlHttpRequest
function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}
var http = createObject();
//spedisco la richiesta
var myRequest = createObject(myHandler);
myRequest.open("POST","sendmessage.php");
myRequest.send(null);
//funzione gestire le richieste
function myHandler() {
if (myRequest.readyState == 4 && myRequest.status == 200) {
alert(myRequest.responseText);
}
}
index.php
Codice PHP:
<script src="ajax.js" type="text/javascript"></script>
<form method="post">
<textarea cols="20" rows="2"></textarea>
<input type="button" onClick="myHandler"/>
</form>
Aiuti?Attualmente mi appare un alert con tutto il codice di index.php