I have this JQuery piece of code. I want to see wht php outputs. How do I print that.
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<script>
$.ajax({
url: "script.php",
type: "POST",
data: { name : "John Doe" },
dataType: 'json',
success: function(msg){
alert(msg);
}
});
</script>
<HTML>
script.php
<?php
$name = $_POST['name'];
echo $name;
?>
Try this:
If what you are asking is how you run the PHP script, you’ll have to install a web server (e.g. Apache) with the PHP extension.