php - Wordpress Jquery Load() is loading wrong url due to permalink -


i made template in wordpress theme , have problem jquery load function load html div using load.php file exists in same directory template.php file problem jquery seeing permalink of page instead of seeing correct url/path load.php file.

e.g jquery seeing mywebsite.com/permalinkhere/load?variable11=23&variable3=43 gives 404 not found

what jquery should see mywebsite.com/wp-content/themes/mytheme/load?variable11=23&variable3=43

how can solve problem?

edit:

load.php echo html; , working fine outside wordpress. here part of template.php code:

<script> $("#first-choice").load("load.php?variable1=load", function() { $("#first-choice").prop("disabled", false);  }); </script> 

yes. java scripts called in html files relative file include java scripts (if use relative path).

you can use wp_localize_script set load.php file url.

wp_localize_script( 'jquery', 'ajaxload', array( 'ajaxurl' => get_template_directory_uri().'/load.php' ) ); 

then

var loadurl = ajaxload.ajaxurl+'?variable1=load'; $("#first-choice").load(loadurl, function() {   // code here .. } 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -