1. Home
  2. Docs
  3. Simpods MVC
  4. Tutorials
  5. Ajax
  6. Ajax for A Specific Page at the Backend

Ajax for A Specific Page at the Backend

You can create an Ajax file for a specific page at the backend.

  • If you want to create an Ajax file for an existing WordPress page, such as wp-admin/edit.php, create it in the mvc/admin/ajax folder with the same file name, so it will be mvc/admin/edit.php in this example.
  • If you want to create an Ajax file for a custom page loaded with ?page=a-custom-page in the URL, create it in the mvc/admin/ajax folder with the same value of the page parameter, ending with .php, so it will be mvc/admin/a-custom-page.php in this example.

Here is the path to the sample: mvc/admin/ajax/ajax-sample.php. You can always clone it and then customise to your needs.

As long as you name your class as Ajax_Sample, it will be auto-instantiated.