Hi. This is just my learning practice, in which I've just made a simplest home.php and get.php page.
The Call is made from home.php and the PHP code code is in get.php which is echoing a paragraph tag.
This is my Ajax Code:
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="container">
<div id="para">
<button id="clickButton">click</button>
</div>
<div id="text">
</div>
<script src="jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#clickButton").on("click", function (e) {
debugger
$.ajax({
url: "get.php",
//type: "POST",
success: function (data) {
$("text").html(data);
}
});
});
});
</script>
</div>
</body>
</html>
this is get.php code:
Code:
<?php
$a = "<p>This is paragraph</p>";
echo $a;
?>
Question:
I don't receive my result in the DIV with ID text.
I don't get any error.
Please guide where is the mistake.
Thank you.