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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:48:26+00:00 2026-06-06T08:48:26+00:00

I’ve literally been trying to debug this for a full day and it’s utterly

  • 0

I’ve literally been trying to debug this for a full day and it’s utterly bewildering. looking for some hints.

i have these functions inside a javascript namespace:

var ZZ = {
  bar: function(data) {
    console.log(data);
  },
  foo: function() {
    $.ajax({
      'url':'/test',
      'type':'GET',
      'dataType':'jsonp',
      'success':function(ret_json, status) {
        console.log(ret_json);   // SUCCESS_1
        console.log(ret_json[1].title);   //SUCCESS_2
        bar(ret_json);
      }
    });
  },
...
}

so i look at the ‘net’ tab of developer tools and the json returned is correct.. something like:

[{'id':1, 'url':'http://a.com', 'title':'hi'}, {'id':2, 'url':'http://b.com', 'title':'hi2'}]

now i look at the console and see that at SUCCESS_1, it prints out something like:

[{'id':1, 'url':'http://c.com', 'title':'hi3'}, {'id':2, 'url':'http://c.com', 'title':'hi3'}]

as you can see, the id is correct, but url and title is not. (i can also change the ids in the database and they will be correctly carried through)

then the next line at SUCCESS_2, it grabs the correct title! ‘hi2’

next i put a debugger statement in to the success function:
ret_json looks totally correct, but when i step into the bar() function.. the data looks wrong again.

next i add:

var hi = {};
console.log(hi);

into the success function.. it prints out.. (not joking)

{'url':'http://c.com', 'title':'hi3'}

so basically, this “default” is overwriting whatever was actually there.

i’ve added cache:false to the ajax call, i’ve tried json and jsonp, i’v tried clearing cache, i’ve tried using chrome/safari/firefox.. but nothing doing and i doubt it’s something that obvious… it’s jsut really really effed up.

any other ideas of what I can try?


UPDATE: adding this namespace to a different html page.
the most egregious example of

var hi = {}
console.log(hi)

printing stuff is gone
but the original problem of the ret_json having wrong data is still present.
(i still don’t have access to a working version of the previous html page)

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

    @ggez44, this is because the console.log is not a synchronized call in Chrome/Firefox/Safari. There is usually a delay of a few ms.

    It looks on my machine the delay is not constant, and is between 4ms and 16ms in Chrome, and about 2ms in Safari.

    http://techblog.appnexus.com/2011/webkit-chrome-safari-console-log-bug/

    Bizarre console.log behaviour in Chrome Developer Tools

    My speculative solution to this is to do something like “console.log(a.toJSON());”. Then you end up with a pointer to the string object passed in, which is not tied to the original object.

    Update: Apparently this is a “feature, not a bug”. There are a few quite decent links into the tickets in webkit mailing list.
    Why does javascript object show different values in console in Chrome, Firefox, Safari?

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to loop through a bunch of documents I have to put

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.