![]() |
Making Ajax calls with jquery in WordPress
I am trying to implement this script on a page in WordPress to make ajax calls with jquery to load content contained in the file /ajax/load.php to the <div id="result"> container.
<div id="result" class="functions"> </div> <div> <input type="submit" value="Next" id="load_basic" /> </div> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> $.ajaxSetup ({ cache: false }); var ajax_load = "<img class='loading' src='img/load.gif' alt='loading...' />"; // load() functions var loadUrl = "ajax/load.php"; $("#load_basic").click(function(){ $("#result").html(ajax_load).load(loadUrl); }); </script> The script works fine for me on a static hand-coded page, but I can't get working in WordPress. I've tried reading the WordPress codec and other sources and from what I gather I need to add the wp_enqueue_script function to function.php to get ajax working in WordPress. I am new to WordPress and ajax, and unfortunately I am not sure how to implement wp_enqueue_script. Can anyone provide some help on how to get this ajax load script working in WordPress? |
All times are GMT -7. The time now is 08:32 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc