I am trying to get an ajax response on WordPress, currently, it's showing me a 404 error on the staging server but on dev it's working fine.
I know the problem is due to the use of "forward-slash(/)" in the URL on staging but on dev it's working with or without forward-slash just after admin-ajax.php. Please check the below URL so that you all can understand this in detail
Staging Environment:
URL NOT WORKING(with / ) on staging:
staging/wp-admin/admin-ajax.php/category/movies/?action=get_movies?action=get_my_post
URL WORKING WITHOUT ( / ) on staging:
staging/wp-admin/admin-ajax.php/category/movies/?action=get_my_post
Dev Environment:
URL WORKING(with / ) on staging:
staging/wp-admin/admin-ajax.php/category/movies//?action=get_my_post
URL WORKING WITHOUT ( / ) on staging:
staging/wp-admin/admin-ajax.php/category/movies/?action=get_my_post
as you can see if I remove forward-slash after admin-ajax.php it's working fine on staging but with a forward-slash , it's not working, where is dev environment it's working with our without forward-slash
Ajax code:
function get_movies()
{
require_once themespro_classifier_addon_template_exsits('movies/templates/grid');
get_search_tems( $category_for_push ,$paged);
wp_die();
}
.php
files generally wouldn't have a trailing forward slash/
. Have you checked your HTACCESS file rules in the WordPress root folder?