@jakeransom1504
If I’m understanding this correctly you are using a jQuery .load() call to reference a PHP file but in that file you want to run do_shortcode().
It seems quite likely that your ‘file.php’ is operating outside of WordPress so you need to find a way in include all of the WordPress functions you require.
do_shortcode() is located in wp-includes/shortcodes.php so in your file.php file you may need something like this before your first call to do_shortcode():
if ( ! function_exists( 'do_shortcode' ) ) {
require 'wp-includes/shortcodes.php';
}
Requiring shortcodes.php might work in this instance, but generally speaking it’s poor practice. Many WP files are dependent upon many others and resolving dependencies is often difficult. IMO you really ought to load the entire WP environment if you want to use WP resources at all. There are really only a few ways to properly do this. Either make a custom page template out of your file, add a WP page that uses it, and request that page; or send requests through admin-ajax.php or admin-post.php.
admin-ajax.php of course requires JS Ajax techniques on the requesting page. admin-post.php is similar in that you add an action to have your PHP execute, but no JS is required. Despite its name, GET request will also work. I think admin-post.php is really useful for executing custom code, yet it’s little documented. There’s really not that much to it. Reading the file’s source might be enough of an explanation.
It may seem like overkill in some cases to load all of WP just to use a particular function. That may well be. Consider if your code really needs WP resources. If you can get by without WP resources without too much effort then you should do so. Otherwise load the whole thing, it’s not as an onerous load on servers as it might seem.