Ajax request returning full page code

My issue was simple; jQuery.post(MyAjax.**ajax_url**, data, function(response) { was meant to be: jQuery.post(MyAjax.**ajaxurl**, data, function(response) { problem solved… sorry

Custom PHP endpoint for a plugin’s AJAX call

First of all, you shouldn’t call your own PHP file. You should use admin-ajax endpoint. Documentation On admin side, you could use ajaxurl to get URL for AJAX calls. On front side you have to declare by yourself variable with url. This is written in documentation: Note: Unlike on the admin side, the ajaxurl javascript … Read more

Using ajax on categories and wordpress loops

Yes this is possible with WordPress but I would not use index.php but a custom front-page.php template then create a page called home and set it as the front page in options-general. For your category menu: <?php $categories = get_categories(); ?> <ul id=”category-menu”> <?php foreach ( $categories as $cat ) { ?> <li id=”cat-<?php echo … Read more

Saving (Updating) Post / Page Edits With AJAX

The german (core) developer Dominik Schilling/ocean90 has released a pretty nice, simple and small plugin to encounter (part of) this problem. Instead of adding a complex AJAX save process, that would just make it harder to work with even handlers and such (de- & re-registering them), he just added a position marker, that allows WP … Read more