Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8533327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:56:21+00:00 2026-06-11T09:56:21+00:00

I have read the documentation and some online resources for the .load() method, and

  • 0

I have read the documentation and some online resources for the .load() method, and for the app I am building it is not working. Please note I have never had to use .load before.

<script type="text/javascript">
$(document).ready(function() {
  $('#next').click(function(e){
    alert("Click"); // this alerts when clicked as expected
    $('#atestimonial').load('testimonial.php', function() {
        alert('Load was performed.');
    });
    return false;
  });
});
</script>

The event works as intended. That code block is in header.php (using wordpress) and the actual div #atestimonial is in sidebar.php, so it is in different files; does this matter?

Inside of testimonial.php is this:

<?php 
include('testimonialPull.php');
echo "Bahh";
?>

testimonialPull.php

<?php
require_once('../../../wp-blog-header.php');
    query_posts(array(
        'cat' => 4,
        'order' => 'ASC', // ASC
        'orderby' => 'rand',
        'showposts' => 1,
    ));
    $wp_query->is_archive = true; $wp_query->is_home = false;
    if (have_posts()) : while (have_posts()) : the_post();
    the_content();
    endwhile; endif;
?>

If i remove the contents of testimonialPull, then it echos correctly.

Which just gets a random post into the atestimonial div.

The structure of the actual div and button is this:

<div id="testimonials">

<div class="tHeading"><h4>Client Testimonials</h4></div>

<div class="atestimonial">
    <?php
    include('testimonial.php');
?>
</div>
<div id="next"><a id="nextC" href="#" return="false">NEXT TESTIMONIAL</a></div><!-- END #next -->

</div><!-- END #testimonials -->

So, have I done something wrong for the testimonial to not show in the div with the .load?

Thank you for taking time to read this.

FAST EDIT

This is working on localhost; I have just read that this does not work with localhost, is this correct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:56:22+00:00Added an answer on June 11, 2026 at 9:56 am

    You’re asking jQuery to fill $('#atestimonial'), that is an element whose id is atestimonial but you don’t have such element in your page.

    Replace

    <div class="atestimonial">
    

    by

    <div id="atestimonial">
    

    EDIT :

    by reading your comments I think you may have a path problem, depending on where you include your script.

    Instead of

    $('#atestimonial').load('testimonial.php', function() {
    

    You may need something like

    $('#atestimonial').load('/testimonial.php', function() {
    

    or

    $('#atestimonial').load('/ggg/testimonial.php', function() {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read some of the basic Google Apps Script documentation/tutorials. I have not
I've read some documentation on how Adaboost works but have some questions regarding it.
I have read the Apple documentation regarding Mobile Device Management (MDM) but did not
I started using ELMAH and I think its great. I read some documentation online
I have read some documentation and blogs about the difference between merge a range
I have read Pyramid documentation and some tutorials, but still don't know how to
I have an app that will need to cache some images. I have read
I have read the documentation provided at MSDN, and some other posts on this
I have read documentation for functions such as values and define-values that return and
I have read the documentation and searched all over but I can't find how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.