PHP script:-
<?php
header('Access-Control-Allow-Origin: *');
echo "Done";
?>
AJAX script:-
$(document).ready(function(){
$('#submit').click(function(){
$.ajax({
type : "POST",
url : "http://127.0.0.1/ionic/retri.php",
success : function(data){
alert(data);
$('#card').text(data);
}
})
});
});
HTML:-
<button id="submit" class="button button-block button-positive">
Submit
</button>
<div class="card">
<div id="card" class="item item-text-wrap">
</div>
</div>
I have just started learning AJAX and wrote this script just to echo simple text and update the html div but I am not getting any output.