Title: WordPress shortcut with jquery load function
Last modified: August 30, 2016

---

# WordPress shortcut with jquery load function

 *  [hugo2808](https://wordpress.org/support/users/hugo2808/)
 * (@hugo2808)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/wordpress-shortcut-with-jquery-load-function/)
 * Hello,
    I have a page template that load with no problem my mat_data.php file
 *     ```
       <?php
       get_header(); ?>
       <script type="text/javascript">
       	jQuery(document).ready(function($){
         		$('.mat_id').click(function(){
           			var id = $(this).attr("id").substring(7);
       			$("#testehugo").load("/wp-content/themes/twentythirteen-child/mat_data.php", {mat_ID: id});
       		});
       	});
       </script>
   
       	<div id="primary" class="content-area">
       		<div id="content" class="site-content" role="main">
   
       			<div class="entry-content" style="margin-top:30px; margin-bottom:30px">
       				<div id="div_mat">
       					<?php global $wpdb;
       					$mats = $wpdb->get_results( "SELECT ID_Car, Brand, Model FROM wp_cars WHERE ID_User = ". $current_user->ID );
   
       					foreach ( $mats as $mat )
       					{
       						?><div id="mat_id_<?php echo $mat->ID_Car;?>" class="mat_id">
       						  <span class="car_name"><?php echo $mat->Brand;?> - <?php echo $mat->Model;?></span><br>
       						  <?php echo $mat->ID_Car;?>
       						</div><?php
       					}
       					?>
       				</div>
       				<div id="testehugo">
       					<?php include('mat_data.php'); ?>
       				</div>
       				<?php the_content(); ?>
       			</div><!-- .entry-content -->
   
       		</div><!-- #content -->
       	</div><!-- #primary -->
   
       <?php //get_sidebar(); ?>
       <?php get_footer(); ?>
       ```
   
 * mat_data.php:
 *     ```
       <div id="teste_mat_user">
           <?php
       		echo do_shortcode('[wpdatatable id=1 var1='.($_REQUEST["mat_ID"]).']');
           ?>
       </div>
       ```
   
 * The problem is that when I reload div class mat_id by clicking it, I get 500 (
   Internal Server Error)
    Is there some issue with shortcodes and load function?
 * Thanks for the help

Viewing 1 replies (of 1 total)

 *  Thread Starter [hugo2808](https://wordpress.org/support/users/hugo2808/)
 * (@hugo2808)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/wordpress-shortcut-with-jquery-load-function/#post-6850844)
 * Apparently I’ve got to include the wordpress strucuture because my file doesn’t
   load it automatically
 *     ```
       require_once('/{WP DIR/wp-load.php');
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘WordPress shortcut with jquery load function’ is closed to new replies.

## Tags

 * [jquery](https://wordpress.org/support/topic-tag/jquery/)
 * [load](https://wordpress.org/support/topic-tag/load/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [hugo2808](https://wordpress.org/support/users/hugo2808/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/wordpress-shortcut-with-jquery-load-function/#post-6850844)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
