What I assume is happening is when you are viewing a page with pretty permalinks, your relative URL breaks: submenu.php becomes http://yourdomain.com/pagename/submenu.php
Try using .ajax instead:
$.ajax({
type: "GET",
url: "http://localhost/submenu.php",
data: "cat=32"
}).success(function(data) {
$('#content').html(data);
});
This behavior wouldn’t happen using the standard URI query because no URI segments are added, therefore the browser would always know to look in the root. Using the ajax function is a much better solution than the load function.
Related Posts:
- Can I use the same nonce for multiple requests on the same page?
- how to get permalink structure with php
- Real time Duplicate title check
- Load custom field value into div with AJAX
- Accessing a random image via ajax
- Data fetch and delete by ajax request
- Making a follow button, Ajax not talking to php
- Put a link to a category round a hard coded A HREF
- Ajax form submit within a Post Metabox
- WordPress automatically adds tags when pasting code, how to stop it?
- WordPress File handle – fopen, fwrite not working with $.ajax or $.post Jquery
- Stumped – Ajax Response Returns 0
- doing an ajax request always outputs 0
- Trying to implement Ajax comments in WordPress, getting WP error
- Can’t search posts using WP_QUERY inside AJAX Function
- Woocommerce add to cart quantity buttons with AJAX
- class click counter save number
- Any possible way to make $wpdb->get_results() return anything else than array?
- Add prefix to link url
- Ajax – Call to undefined function get_option()
- Ajax load more posts with multiple tax query
- Ajax call not working
- WordPress Sending data to Ajax with select option
- PHP 8, AJAX mail form to function.php doesn’t work
- Changes in permalink structure in WordPress and how to apply to in-site links
- Ajax request not sending to server and returning – wp-admin/admin-ajax.php 400
- How to use $_GET function WordPress backend
- Repeating admin-ajax.php not found error in admin
- populate form fields in a loop with ajax
- How to send Ajax request from my plugin in admin dashboard?
- How to pass Select value from Javascript to PHP to generate select option on change
- AJAX success response is not working but it’s saving my changes
- how to make custom ajax handler?
- Plugins not working on AJAX requests
- How to disable controls in theme customizer?
- How do I Import / Upload Files with jQuery AJAX?
- wp ajax return 0
- WordPress plugin: render only page content using ajax call
- WordPress ajax-action failing because of newline in response
- HTML escaping data with ajax requests
- Function won’t run onclick using Ajax
- How to deal with too many $_POST variable conditions from ajax request at backend? [closed]
- Is it possible to create new user from external form using REST API?
- Get related product based on subcategory selected from category id with ID 142
- WP_Query with AJAX returning empty array
- Loading Posts & Category with Ajax
- How to get post category list as select in front-end?
- PHP Warning: Missing argument 2
- Is there a hack for using is_page() within the function.php file?
- how to edit a specific post slug using a php code?
- How to SELECT number from table and use in calculation . Unsupported operand types
- Submit form to db
- Insert PHP code in Text
- Change Query Arguments (filter) with jQuery/Ajax or PHP?
- custom add note meta box with add button in wordpress
- Disclaimer that will show every refresh of the page
- understand what code is doing when prepending /blog
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- How do I make these combination select filters work when only one dropdown is set? They work in WordPress 5.8.2 but don’t in 5.8.3
- duplicate posts with ajax load more wordpress
- Failed to load resource: the server responded with a status of 500 (Internal Server Error) through wp_admin_ajax.php
- 404 on old link after changing post url
- My Custom Post Type AJAX Query is Returning no posts – why?
- Change ajax live search results
- Ajax filter with loadmore button
- Update $wpdb query with AJAX
- AJAX and custom pages
- $.ajax results in 403 forbidden
- Permalink changes after several minutes after saving post
- AJAX to add to cart multiple products woocommerce
- Cannot successfully execute AJAX script to call function.php specific function. Using XAMPP localhost to test
- autocomplete in wordpress using ajax with json-data
- How can i get the same ajax result using WP REST API instead of admin-ajax?
- AJAX Filter WHILE Loop not working WordPress
- wordpress ajax pagination
- Why I’m Not Having Access to “$_POST” Data Outside My AJAX Callback?
- Ajax call URL 404’ing when pushed to staging server
- WordPress Rewrite Issue
- Would it be possible to route WordPress Through an MVC Application
- 500 (Internal Server Error) of external php file
- Problems with plugin that fetches data from database with ajax
- Get permalink for a post from inside WordPress and route to a related site
- Make a permalink to the most recent blog post
- Cookie not created in AJAX request
- Accessing WordPress Functions get_permalink() in Vanilla PHP?
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- notify users when changed database
- How to use url and amin-ajax.php
- WP – Ajax call back data printed in the console.log
- How to Set Page Pagination Using Ajax JQuery – WordPress
- How to pass and validate nonce in custom REST routes
- ajax problems on loading page [closed]
- Woocommerce – Include custom user meta in order ‘filter by registered customer’ Ajax search
- AJAX WP_Query’s order and orderby parameters not working
- How can I use AJAX in child theme template?
- How to automatically flush permalinks?
- Execute wp_after_insert_post after the permalink is customized
- Help with AJAX request
- Start a long running PHP process via JS/Ajax and monitor progress on admin page
- Post returns 404 after changing the permalink using post_type_link