iam creating a site using wordpress themes.in my contact form i have used ajax to pass multiple values to another php file.By this code

    <script language="javascript">  
    function addAnnouncement1()
    { var name = document.getElementById("name").value;
        var email_id = document.getElementById("email_id").value;
        var mb_no = document.getElementById("mb_no").value;
    alert("ok");
        var xmlhttp;    if (window.XMLHttpRequest)
          {// code for IE7+, Firefox, Chrome, Opera, Safari
          xmlhttp=new XMLHttpRequest();
          }
        else
          {// code for IE6, IE5
          xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
          }    xmlhttp.onreadystatechange=function()
          {      if (xmlhttp.readyState==4)
            {            if(xmlhttp.status==200){ document.getElementById("result").innerHTML=xmlhttp.responseText;
                }
            } }
         var variables = "email_id="+email_id+"&name="+name+"&mb_no="+mb_no;      xmlhttp.open("POST", "../contact_us.php", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
  xmlhttp.send(variables); 
     return false;
              }
     </script>

My bug is in this line

var variables = "email_id="+email_id+"&name="+name+"&mb_no="+mb_no;  

while passing in contact_us.php file i can get only email_id value alone.Mistake is it is not accepting ‘&’ symbol.clear my doubt how to pass the value?

Read more here: Php Ajax in wordpress


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, ,

Wordpress related questions and answers: