Yes AJAX will do.
A 'basic' code would be something like:
Code:
function createXMLHTTPRequest(){
var http=null;
if(window.ActiveXObject){
var progIds=Ajax._PROG_IDS;
for(var i=progIds.length; i>=0; i--){
try{
http = new ActiveXObject(progIds[i]);
break;
}catch(e){}
}
}else{
try{
http = new XMLHttpRequest();
}catch(e){
}
}
return http;
};
function handleResponse(xmlhttp){
var res=xmlhttp.responseText;
//do other things
}
function postData(callback){
var http=createXMLHTTPRequest();
http.open("POST","/post.php",true);
http.onreadystatechange=function(){
if(4!==http.readyState){
return;
}
var status=http.status;
var isOK=(!status || (status >= 200 && status < 300));
if(isOK){
callback(http);
}else{
alert("An error occurred:\n"+http.responseText);
}
}
http.send("var1=value1&var2=value2");
}
function test(){
postData(handleResponse);
}
Then in page /post.php,you can retrieve variable var1 and var2,in the same
way you do with them submitted via Form.
However,for production usage,I recommend you use some kind of AJAX framework(jQuery for example).
Bookmarks