Jquery Ajax and php classes

ajax, jquery, oop, php

Solution

Short answer: No.

Long answer:

Ajax is just a term for making an HTTP request from the browser, using JavaScript, without leaving the page.

The only thing you can "call" is a URL.

You can write your PHP to do something based on what the URL is though.

<?php
    if ($_POST['action'] == "delete") {
        delete();
    }
?>

Problem

I'm trying to learn how to use oop in php. I'm also fairly new to jquery. Is it possible to make an Ajax request to a php class method? I've only ever sent Ajax requests to a file specifically for that purpose and that returns the data I need.

Original source