# Other Programming > AJAX >  POST two or more variables using AJAX

## kku

hi gurus.
how can we send two or more values of variables using AJAX to PHP script
my code is:-
<script type="text/javascript">
function ajaxFunction()
  {  var xmlHttp;
  try
    {    // Firefox, Opera 8.0+, Safari 
       xmlHttp=new XMLHttpRequest();   
      }
  catch (e)
    {    // Internet Explorer 
       try
      {      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      }
    catch (e)
      {      try
        {        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        }
      catch (e)
        {        alert("Your browser does not support AJAX!");        return false;        }      }    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
        document.myForm.mess.value=xmlHttp.responseText;
        }
      }
	  var url="varify.php";
	 // var params = document.myForm.
	 var nam = document.getElementById('name').value;
	 var pas = document.getElementById('pass').value;
	// alert(pass.value);
	// alert(name.value);
	params="name="+nam+"pass="+pas;//cancatenation


	// var pass = document.myForm.pass.value;

    xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(params);  //here i wana send 2 parameters ie name and password

}
	</script>

----------


## kku

hay gurus I got solution code is given below ie



params="name="+nam+"&pas="+pas;//cancatenation
this action ca help us to post

----------

