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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:06:23+00:00 2026-06-05T10:06:23+00:00

Alright, I’ve got an interesting issue. My page makes a JSON request every once

  • 0

Alright, I’ve got an interesting issue. My page makes a JSON request every once in a while. If the data hasn’t changed, it doesn’t need to do anything. The problem is, I can’t figure out a way to prove if it has changed or not.

I tried something like this to no avail:

var stations = null;

function parseDynamicData(ard) {
    //this was something that gave me problems for days
    //nice little hack to fix it
    if (ard['details']['enabled'] == 'true' && ard['song']['art'] != 'undefined');
    {
        //turns off the 'server offline' page
        if (document.location.toString().indexOf('#offline') != -1)
            document.location = '/#tracks';
        //update UI
        $('#track-title').html(htmlDecode(ard['song']['title']));
        $('#track-artist').html(htmlDecode(ard['song']['artist']));
        $('#track-album').html(htmlDecode(ard['song']['album']));
        $('#track-art').attr('src', htmlDecode(ard['song']['art']));
        //set if it's play or pause visible
        if (htmlDecode(ard['details']['playing']) == 'true') {
            $('#control-pauseplay').html('Pause');
            $('#control-pauseplay').attr('href', '/track?proc=2');
        } else {
            $('#control-pauseplay').html('Play');
            $('#control-pauseplay').attr('href', '/track?proc=3');
        }
        //Now update all of the stations
        if (stations == null || stations != ard['stations']) {
            $.each(ard['stations'], function (key, value) {
                alert(key);
            });
            stations = ard['stations'];
        }
    }
}

Here is what a normal JSON response looks like:

{
    "song": {
        "art": "http://cont-sjl-1.pandora.com/images/public/amz/6/2/3/3/886978533326_500W_500H.jpg",
        "title": "Hold It Against Me",
        "artist": "Britney Spears",
        "album": "Femme Fatale Deluxe"
    },
    "details": {
        "playing": "true",
        "enabled": "true"
    },
    "stations": {
        "undefined": "False",
        "Alex Clare Radio": "False",
        "Rap Strength Training Radio": "False",
        "Drops Of Jupiter Radio": "False",
        "Tween Radio": "False",
        "Today's Hits Radio": "True"
    }
}

No matter what I do, however, it still goes through the JSON making an alert for every key. Does anybody know what I should do?

  • 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-05T10:06:25+00:00Added an answer on June 5, 2026 at 10:06 am

    I suspect that stations and ard['stations'] are different objects that are identical in structure. If you are rebuilding ard after each JSON request while stations holds the array from the previous ard, then the two objects are not the same object, so an exact match will fail, regardless whether the objects have identical key-value pairs.

    What I would do is keep a exact string copy of the last JSON message and compare it with the current JSON string message before you parse it. Otherwise, you’ll need to compare every single key-value pair of the current object against the prospective new one — and if some of those values are objects themselves, things could get a little (needlessly) hairy.

    If you can be certain that the server will always stringify a given object O the same way (and assming you don’t need to worry about checking if an object on the client has mutated), then you can simply compare the JSON string versions of the object from the server.

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

Sidebar

Related Questions

Alright, hoping someone can help. I've got a page used to search for employees.
Alright, So I have an issue that is a bit weird. I am using
Alright, here is my problem i'm trying to solve. I have an index page
Alright, so I'm currently working on a game and ran into a memory issue
Alright, I have a script that takes a few arguments, runs data, and then
Alright so I have recently made the decision to put every string in my
Alright guys, this should be a very simple request. I'd like to run a
Alright, I have been doing the following (variable names have been changed): FileInputStream fis
Alright. So I have a very large amount of binary data (let's say, 10GB)
Alright, after doing a ton of research and trying almost every managed CPP Redist

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.