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

  • Home
  • SEARCH
  • 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 8319275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:16:27+00:00 2026-06-08T22:16:27+00:00

I’m having issues using .get calls to update elements via page load or button

  • 0

I’m having issues using .get calls to update elements via page load or button press.

The code…

$(document).ready(function() {
    //updateVariable();
    $('#dannychoolink').html('<?php dannyChoo()?>');
    $('.danny-choo').attr('target', '_blank');
});

$('#clicky').mouseenter(function() {
       $('#dannychoolink').html('Click for a Random DannyChoo.com Article');
        }).click(function() {
            updateVariable();
            $('#dannychoolink').html('YA!');
            //$('#dannychoolink').html('<?php dannyChoo()?>');
            //$('.danny-choo').attr('target', '_blank');
        });

function updateVariable() {
    $.get('random.php',
           function(output){ 
                $('#dannychoolink').html(output);
                $('.danny-choo').attr('target', '_blank');
            }
        );
};

The function updateVariable() calls random.php which holds a single function which echos a database entry like this:

<a href="http://www.dannychoo.com/post/en/26568/Nendoroid+Moekana.html" class="danny-choo">Nendoroid Moekana</a>

The idea is to load a random entry (which is done inside the function) either on page load and click.

This works perfectly on my home page (http://www.danielbough.com), but does not work as expected on individual articles (the updateVariable function actually returns a WHOLE page of html identical to an individual article page – if that makes sense.) Any page w/one article does it (http://www.danielbough.com/articles/fun-with-jquery-and-ajax for example.)

Each page is built w/individual files. The ‘homepage’ is

  • header.file
  • navigation.file (the dannychoolink and clicky element
    reside here)
  • homepage.file
  • footer.file

Individual articles are as so:

  • header.file
  • navigation.file (the dannychoolink and clicky element
    reside here)
  • view.file
  • footer.file

I thought I might have some unmatched tags in view.file but there wasn’t any that I could see.

I had to comment out the updateVariable() call in my document.ready function because it kept loading until the page crashed.

JavaConsole shows 'Uncaught SyntaxError: Unexpected token < ' when the individual article pages are loaded or when I click the ‘clicky’ element. I cant determine why.

Note, Google+ and Twitter calls are in the view.file too. I removed them while testing, but it has no affect.

UPDATE
The 'Uncaught SyntaxError: Unexpected token < ' errors were caused by ckeditor.js and Googles jquery.min.js. I’ve updated the Google js library to the ‘full’ version of 1.7.2 and removed the ckeditor.js to test. The java errors went away, but the issue with the get function remains.

  • 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-08T22:16:28+00:00Added an answer on June 8, 2026 at 10:16 pm

    You are trying to access a file via a relative path, in this case random.php, from two different locations on your server. In the article’s case you are trying to get http://www.danielbough.com/articles/random.php which just gives you a regular page with no content which is why you were pulling in that entire html.

    The solution would be to give random.php an absolute url, which I believe is http://www.danielbough.com/random.php. So something like: $.get('http://www.danielbough.com/random.php',

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.