Search code examples
templatesjquery-load

Not able to load .php template via ajax


    userBarToggle.click(function() {
        $('#user-menu').load('wp-content/themes/mytheme/lib/inc/template/user-menu.php');
    });

I get 500 Internal Server Error. Any suggestions why?

  • Button works perfectly
  • Path is correct
  • #user-menu exists
  • Template has PHP & HTML code in it

Also, is there a way to cut off the wp-content/themes/mytheme/ part? I get 404 without it.


Solution

  • If the path is correct, then it should be something wrong with user-menu.php. Did you try erasing everything in that file and return just some text? Also, check the file permissions for it.