How to call PHP class method by ajax with jQuery But No need any PHP handler file.
This is my PHP Class animal.php:-
<?php
class animal
{
function getName()
{
return "lion";
}
}
?>
jQuery:-
<script type=text/javascript>
$.ajax({
type: "POST",
data: {
abc:animal;
},
url: "animal.php",
dataType: "html",
async: false,
success: function(data) {
alert(data);
}
});
</script>
I want to use directly call getName() method in jquery no need any other handler file between PHP Class and jQuery.
Parameter data will be any thing but after success I require "lion" in success data.
Please Help.
animal. Some sort of "handler" will be required.