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 9240005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:06:52+00:00 2026-06-18T08:06:52+00:00

I am reloading a div within my page to reflect variables which have been

  • 0

I am reloading a div within my page to reflect variables which have been updated by the user. With my present method the variables are written into the page via a script tag that is imbedded in the body as follows:

JavaScript

cat = 1;

$("a#foo").click(function() {
    cat = cat + 1;
});

$("a#bar").click(function() {
    $('#bat').load('./index.html #bat > *');
});

HTML

<a href="#" id="foo">add another cat</a>

<a href="#" id="bar">update count</a>

<div id="bat">
    <script> document.write(cat); </script>
</div>

Any thoughts or suggestions are much appreciated. And here is a a jsfiddle for your tinkering convenience.

  • 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-18T08:06:53+00:00Added an answer on June 18, 2026 at 8:06 am

    Are you just reloading the page on clicking the link? I would say you do something like this instead of putting a script tag in your .

    HTML

    <span id="numberOfCats"></span>
    

    Script

    $("a#bar").click(function() {
        $('#numberOfCats').text(cat)
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am have an issue with the page reloading. I have written a simple
I have a div tag within my contact form which holds the captcha items.
I have a jquery to show links in a div without reloading page: jQuery
I have Page A which calls Page B using AJAX. Page B will be
jsFiddle I have a DailyMotion video embedded in my page, through an iFrame, within
I have a page which loads its inner content using jquery and a simple
I need to delaying the reloading of the page. Right now, I have this:
Hello I am having trouble regarding div reloading when a new record has been
I have a div on my page that gets populated via an ajax call
I have a simple page which allows users to add language ids to items.

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.