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

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -

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