I'm trying to load an external php file/widget into another php file via a jQuery-constructed mobile menu bar. The menu bar is <div class="slicknav_menu"> called in the code below. On the front-end I can see the variable loading the blog url okay, but pluginDir doesn't seem to load it in the $ function.
I'm still getting a hang on proper syntax. What am I doing wrong? Does .load accept variables?
var pluginDir = "<?php bloginfo('url'); ?>";
if (document.documentElement.clientWidth < 1030) {
$(".slicknav_menu").load(pluginDir + '/wp-content/plugins/woocommerce-cart-dropdown/cart-dropdown.php');
}
$(".slicknav_menu").load(pluginDir + '/wp-content/plugins/woocommerce-cart-dropdown/cart-dropdown.php');. In javascript+is the concatenation operator for string+in javascript,.is concatenation in PHP+as well, but it doesn't seem to be working either. I'll update it above to show my syntax.bloginfodo anyway? returns astring? you might need someechotherebloginfograbs the url of my site, which i'm concatenating to the exact php file path. I realize it's an odd way of going about it, but it's an existing jQuery mobile menu that I need to load my php plugin into only when the viewport is below 1030px.