0

this is my javascript of first page

 <script>
        function MessageDetailsById(id)
        {
            $("#active"+id).css({"color":"red"});
            var http = new XMLHttpRequest();
             var url = "Ajax.php";
             var adm = "<?php echo $admno; ?>";
            var params = "Id="+id;"adm="+adm;
            http.open("POST", url, true);
            http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            http.onreadystatechange = function() {
            if(http.readyState == 4 && http.status == 200) {
            //alert(http.responseText);
                        }
        }

            http.send(params);

            window.location.href="#";


        }

        </script>

this is the coding of ajax.php

<?php
include("model.php");
$DB=new database;

if(isset($_POST["Id"]))
{
    $DB->updateMassageTitleStauts($_POST["Id"],$_POST["adm"]);

}
else
{
    header("Location:index.php?ajaxmas=wHgfghks^^%&fnjfskjdfb");
}
?>

i want to send one variable of php and another is id of a div... how to send two parameters and recieves them on other side ??? please correct this code in details i am not expert ???

1
  • You can open your browser's developer console with F12 in order to see the syntax errors. Commented Mar 7, 2017 at 3:07

1 Answer 1

3

For the post data encoding:

var params = "Id=" + id + "&adm=" + adm;

Use & for separator.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.