使用ajax将vars发送到php

I can´t send variables to php with ajax with this function, but I can send them with a simple post directly to php and insert them to mysql.

I have test it with php and typical submit form action to the php file and works fine. I don´t know what I am missing. Thanks in advance. Best regards

<form class="largeform" id="editform" name="editform" accept-charset="utf-8"      action=""  onsubmit="enviarDatosEmpleado(); return false">   

any idea? // JavaScript Document function objetoAjax(){

var xmlhttp=false;

try {


xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

} catch (e) {

try {

xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

} catch (E) {

xmlhttp = false;

}


}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

 xmlhttp = new XMLHttpRequest();

 }

  return xmlhttp;

  }
  function enviarDatos(){

 //donde se mostrará lo resultados


  divresultado = document.getElementById('resultado');

  //valores de los inputs

  post_title=document.editform.post_title.value;

  post_metad=document.editform.post_metad.value;

  post_metak=document.editform.post_metak.value;

  post_special=document.editform.post_special.value;

  post_content=document.editform.post_content.value;

  post_private=document.editform.post_private.value;

  post_parent=document.editform.post_parent.value;

  post_template=document.editform.post_template.value;

  post_id=document.editform.post_id.value;

  post_menu=document.editform.post_menu.value;

  post_menu_order=document.editform.post_menu_order.value;




  //instanciamos el objetoAjax

   ajax=objetoAjax();

   //uso del medotod POST

   //archivo que realizará la operacion

  //registro.php


  ajax.open("POST", "insert.php",true);

  ajax.onreadystatechange=function() {

  if (ajax.readyState==4) {

  //mostrar resultados en esta capa

  divresultado.innerHTML = ajax.responseText
  divresultado.innerHTML = "ok";
  divresultado.style.display="block";


  //llamar a funcion para limpiar los inputs

   LimpiarCampos();

  }

  }

  ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");


  //enviando los valores

   ajax.send                 ("post_title="+post_title+"&post_metad="+post_metad+"&post_metak="+post_metak+"&post_special="+post_special+"&post_content="+post_content+"&post_private="+post_private+"&post_parent="+post_parent+"&post_template="+post_template+"&post_id="+post_id+"&post_menu="+post_menu+"&post_menu_order="+post_menu_order)
 // ajax.send("nombres="+nom+"&departamento="+dep+"&sueldo="+suel)

  }

Try with jQuery:

$.post("insert.php", {
    var: value,
    var2: value2
}, function(responseText) {
    $("#resultado").html(responseText);
});

Make sure you include the jQuery library. You won't need to set up the connection ahead of time, FYI.

You are not properly referencing the DOM elements for the form.

You would need to do something like:

document.getElementById('idOfFormElement').value

Also as one commenter mentioned, you should really familiarize yourself with a framework like jQuery, which makes working with ajax much, much easier (And more cross-browser compliant)