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:
- Load more posts using AJAX based on posts inside WP_Query
- Multiple AJAX handler functions conflict in functions.php
- Change ajax live search results
- url not using query string no longer working
- How to call my PHP function with AJAX ? wp_query
- PHP calling AJAX function that relies on passed PHP function values not working
- Ajax result show in console if is called outside function and not showing in array
- Can’t pass var from php wp_ajax into ajax script : result undefined or null
- Custom PHP form needs refresh to load page correctly
- Child-Theme Category View with modified permalinks (%category% removed)
- Ajax filter with loadmore button
- Admin-ajax.php 404 error
- Where to add my PHP codes for AJAX Jquery to work?
- Adding ELSE argument to AJAX Live Search for “No results found”
- How can i find wrong word in search box and replace with correct word
- How to pass values from one function to the other using an array variable
- How to change PHP variables with AJAX request in WordPress
- How to change this ajax function to submit to the default wordpress content area instead of the custom field ‘seller notes’?
- How to use wp_ajax_set_post_thumbnail?
- How can I get my WordPress plugin to receive data and relay it in an ajax/php request to a remote server that requires authentication?
- register_block_type is not working properly
- Rewrite rule not working, but only when parameter is text
- get_the_author_meta( ‘ID’ ) just return 1
- Submit remote form to wordpress REST API and save data to custom post type
- Update $wpdb query with AJAX
- ajax contact form not submit message
- WooCommerce REST API AJAX Auth – 401 response
- Can an AJAX callback function access a PHP variable which was defined during initial page load?
- AJAX and custom pages
- custom mailchimp form using HTTP API
- How does Permalink work with the AMP plugin after Removing Parent Permalink Catalog from Posts
- $.ajax results in 403 forbidden
- 400 bad request admin-ajax file upload
- Get WordPress username to customize url
- Can’t make lazy load for my site, help!
- WordPress is setting from header wrongly in wp_mail
- AJAX numerical pagination problem in TwentyFifteen-child theme
- How to reload a php script, using AJAX and jQuery
- Permalink doesn’t navigate to post (changes only url)
- Change WooCommerce currency programmatically on AJAX request
- Post permalink buttons all going to the first post
- wp_ajax_ 400 Bad Request
- Filtering custom posts by using checkboxes for taxonomy in an ajax loop always gives server 500 error
- Permalink changes after several minutes after saving post
- AJAX to add to cart multiple products woocommerce
- How to edit button permalink inside function.php using a child theme?
- use with class file into wp_ajax hook
- update_post_meta Not Processing Array Data (Not Sure What I Am Missing)
- WordPress/NGINX not respecting the category URL for new posts
- WordPress AJAX PHP(html) file that is within WordPress Loop
- why css file not link?how to create permalink?
- getJSON response to PHP
- ajax problems on loading page [closed]
- Woocommerce – Include custom user meta in order ‘filter by registered customer’ Ajax search
- WooCommerce Modal Fly cart on add to cart – With AJAX
- AJAX returning blank result
- AJAX WP_Query’s order and orderby parameters not working
- How can I use AJAX in child theme template?
- Word press – JSPDF – Sending PDF as attachment from wp_mail – Special characters
- Upload multiple files via ajax from an HTML file input
- using AJAX [object Object]
- How to pass javascript var to php var
- Ajax infinite scroll random order shows duplicate posts on custom post type
- Ajax – how to use XMLHttpRequest in wordpress
- How to automatically flush permalinks?
- Execute wp_after_insert_post after the permalink is customized
- Help with AJAX request
- WordPress CPT & Custom Taxonomy with the SAME Permalink Structure
- I got this error POST https://localhost/meraboilerwp/[object%20Object] 404 (Not Found)
- How can I display a Divi content inside a modal based on an AJAX request
- Start a long running PHP process via JS/Ajax and monitor progress on admin page
- Display posts based on the selected category when no subcategory is chosen
- custom AJAX filtering logic and outputting results into an Elementor Loop Grid widget
- How to make this shortcode not refresh the whole page when i use it on frontend
- Remove slug of multiple custom post types with and without hierarchical
- Session seems to break
- Data insertion after clicking a button does not work (script, AJAX, PHP)
- WordPress Insert line in DB when clicking a button
- Modify the permalink structure for a specific category
- Help with uploading file with AJAX and PHP
- Help with creating commenting system using PHP, jQuery and AJAX
- Update shortcode values using ajax call
- Woocommerce – how can i add items to cart using onclick – multiple items at once with custom prices
- change the blog in the url if you go from a specific page wordpress
- Is it possible to go to the next post in the same category?
- ajax select parent show child in another select and show posts in another select-ajax filter search
- WordPress per ACF – permalink is not working
- Processing data and redirecting with query string
- I’ve added SKU to Woocommerce permalinks, but I have small issue
- WooCommerce Mini-Cart Problem
- Post returns 404 after changing the permalink using post_type_link
- Trying to GET data with ajax from database and show in fullcalendar
- AJAX Appending Data Adds Mystery “0” :(
- Add/Remove User Meta Array via AJAX
- Ajax Filters with Multiple tax_query args
- GET admin-ajax.php returning 400 bad request error
- Issue with Ajax filter categories and Javascript
- Cannot access the other pages after successfully editing post type
- How do I ensure that the URL parameters are updated correctly when multiple filters are applied
- Filtered queries not responeding to page path