How to add template in codeigniter |how to create template in codeigniter| template in codeigniter 4
How to use jquery ajax with php: If you want to get data from server script or send data from server script.You need to use ajax.Full form of ajax is Asynchronous Javascript And XML.
If you want use ajax in your HTML document ,add jquery CDN in your document.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script> $.ajax({ url:"info.php", type:'POST', data:{name:your_name,age:your_age}, dataType:"html", success:function(res) { console.log(res); } error:function(error) { console.log(error); } }) </script>
Now in your php script page receive the data.
<?php $name=$_POST['name']; $age=$_POST['age']; echo "Success"; ?>
You will get the “Success” message in console.
About Script
Everybody know that the jQuery is a cross-platform JavaScript library designed to simplify the client-side scripting of HTML. The jQuery, it is free platform and open-source software using the permissive MIT license. A web analysis indicates that it is the most widely deployed JavaScript library by a large margin
Related posts