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:
- How to get URL of current page displayed?
- Can I use the same nonce for multiple requests on the same page?
- 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
- Colorbox ajax loading of outside HTML content works perfect on localhost but not on server
- 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
- 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
- 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?
- AJAX button action in foreach
- Unset session variable on page reload / setup but exclude AJAX
- WordPress ajax-action failing because of newline in response
- Making an AJAX call to refresh a table
- load ajax using admin-ajax.php
- Ajax button not working
- Simple AJAX notification when the new post is added to the database
- Short code template + ajax
- Divi change project category slug
- Is it possible to create new user from external form using REST API?
- When echo follow Ajax button inside Ajax pagination template not working?
- jQuery Ajax PHP function call returning [object Object]
- Calling PHP Scripts in Ajax that are in PHP Snippets
- Custom post type permalinks do not appear using the link functions
- How to Handle Going Backwards in Navigation When Referrer in PHP/JavaScript won’t work?
- Retrieve Json data and create multiple pages with it
- .html end of URl affected to SEO?
- Loading Posts & Category with Ajax
- PHP Warning: Missing argument 2
- Allow user to Upload image and manipulate it on the frontend
- Creating a Category Taxonomy
- How to SELECT number from table and use in calculation . Unsupported operand types
- what does $options = get_option(‘test_theme’); do?
- Insert PHP code in Text
- How to load previous or next attachment with jquery ?
- Validating an email input from form field before submit using JQuery, AJAX, and PHP
- Change permalink structure specific category
- WordPress cascading dropdown selection search based on Parent Page & Child Page
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- jquery & ajax getting data from php in wordpress . admin-ajax.php returns 400
- Settings API form – submit with AJAX
- My Custom Post Type AJAX Query is Returning no posts – why?
- url not using query string no longer working
- register_block_type is not working properly
- AJAX numerical pagination problem in TwentyFifteen-child theme
- Permalink doesn’t navigate to post (changes only url)
- Filtering custom posts by using checkboxes for taxonomy in an ajax loop always gives server 500 error
- How to edit button permalink inside function.php using a child theme?
- wp_set_object_terms returns 500 error when called through AJAX function
- How can i send id of the currently posted form data through json response in custom wordpress plugin?
- Cannot successfully execute AJAX script to call function.php specific function. Using XAMPP localhost to test
- autocomplete in wordpress using ajax with json-data
- ajax polling with admin-ajax.php
- Remove item from post_meta array via AJAX
- wp_send_json erase last value
- defined (‘ABSPATH’) false after AJAX post to other PHP-file
- How to load WP_Editor JS files manually (with AJAX)?
- 403 Forbidden Localhost Wamp Apache Php
- WordPress 404 when using AJAX to call php function
- wordpress ajax pagination
- Permalinks and custom PHP application
- Submitting my form to the database and then redirecting to payment site
- wp_delete_comment is doing nothing
- Pass the updated value of aid from form using ajax
- 403 (Forbidden) delete file image in themer folder
- Would it be possible to route WordPress Through an MVC Application
- 500 (Internal Server Error) of external php file
- Use jQuery and AJAX to get HTML
- Problems with plugin that fetches data from database with ajax
- Dynamic Gallery
- Execute PHP code in Javascript onclick
- Loading a post’s content, into a div outside the loop, when it’s title is selected in a list
- PHP code for link with text
- Jquery autosave text area after typing
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- how to display tables via ajax
- Save Edit button then disabled readonly metabox