everyone
Hi, everyone
how can i send data from javascript to php and print in php using pure javascript ajax?
file test.php and send data from javascript code in test.php to test.php and print_r($_POST['from input name or name of varitable'])
I searched a lot but couldn't find it
code
<script>
//file test.php
var HTTP=new XMLHttpRequest();
var params={name:"jack",family:"jackers",age:"30"};
HTTP.open("POST","http://127.0.0.1/test/test.php");
HTTP.send(params);
</script>
<?php
//file test.php
if (isset($_POST['name'])){
print_r($_POST['name']."<br>");
print_r($_POST['family']."<br>");
print_r($_POST['age']);
}
?>
dosen't work