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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:42:23+00:00 2026-05-22T15:42:23+00:00

I have a php file which is called every X second in ajax to

  • 0

I have a php file which is called every X second in ajax to refresh a content. This php file return a js file wich must change the html content of a div with a effect.

But I would want to change this content only if the new is different! Else, I have a div which refresh itself with the effect even if it’s the sames contents!

I tested with this code:

if ($('#mydiv').html()!=data_insertion) $('#mydiv').fadeTo("fast", 0, function () {$(this).html(data_insertion).fadeTo("fast", 1)});

But this code isn’t cross browser… Indeed, my data_insertion variable contains some html content. And each browser insert it changing the attribut order etc. That’s why, $(‘#mydiv’).html() is never equal to data_insertion.

  • 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-05-22T15:42:23+00:00Added an answer on May 22, 2026 at 3:42 pm

    You can use a local cache of the result, attached to the element.
    In your ajax callback do something like:

    if (jQuery.data($('#mydiv')[0], 'last_data_insertion') != data_insertion) {
        // Update DOM content
        $('#mydiv').fadeTo("fast", 0, function () {$(this).html(data_insertion).fadeTo("fast", 1)});
    
        // Reset the local cache
        jQuery.data($('#mydiv')[0], 'last_data_insertion', data_insertion);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP file which will return something like <div id=title>Add Us On
I have a php file which has a require_once Statement (?) this file is
I have this code which will include template.php file from inside each of these
so I have a php file called db.php which will be called in the
I have a PHP-file which will be called from a form. So it gets
I have some php file A which is called by cron, from console (php
I have a php file as given below. The page generates html content which
I have a file called init.php which I want to get automatically included in
I have a php-file called kal_test.php which gives a value to the variable $vbl
I have a php file which I will be using as exclusively as an

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.