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 cron job - php script which is called one time in 5
I have a file, caller.php, which takes a GET URI that specifies a value
Ok. I have my query written finally for my php file (which will write
I make an AJAX request to a PHP script which returns a number from
I have the following php code which I found here : function download_xml() {
I'm trying to build an Adobe Air app which runs from a PHP file.
I'm delving into some AJAX and I'm trying to utilise jQuery. I have an
The first line of code, called on every one of my application's pages, is:
I'm trying to use a MERGE INTO statement in my php file to update
i have a design issue regarding sending user data from a mobile phone app

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.