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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:07:00+00:00 2026-06-01T13:07:00+00:00

I have the following code: $(document).ready(function() { $.getJSON(‘../includes/_quiz.php?class_id=163&course_id=183’,function(data){ $.each(data,function(k,v){ questions[k] = v.question; answers[k*4] =

  • 0

I have the following code:

$(document).ready(function() {
    $.getJSON('../includes/_quiz.php?class_id=163&course_id=183',function(data){
        $.each(data,function(k,v){
            questions[k] = v.question;
            answers[k*4] = v.ansO;
            answers[k*4+1] = v.ansT;
            answers[k*4+2] = v.ansTh;
            answers[k*4+3] = v.ansF;
            });

        //html  
        });
    });

the questions array is not being filled, yet when I debug, I get this result:
when I request the page in the browser I receive the same result which is:

[{"question":"\u0623\u0647\u0645 \u0627\u0644\u0635\u0646\u0627\u0639\u0627\u062a \u0627\u0644\u0633\u0648\u0631\u064a\u0629 \u0648 \u062a\u062f\u062e\u0644 \u0628\u0627\u0644\u062a\u0635\u062f\u064a\u0631 :","ansO":"\u0627\u0644\u0623\u0633\u0645\u062f\u0629","ansT":"\u0627\u0644\u0623\u062f\u0648\u0627\u062a \u0627\u0644\u0632\u0631\u0627\u0639\u064a\u0629","ansTh":"\u0627\u0644\u0632\u064a\u0648\u062a \u0627\u0644\u0646\u0628\u0627\u062a\u064a\u0629","ansF":"\u0627\u0644\u0635\u0646\u0627\u0639\u0627\u062a \u0627\u0644\u0646\u0633\u064a\u062c\u064a\u0629","corr":"4"},{"question":"\u064a\u0633\u062a\u0648\u0631\u062f \u0627\u0644\u0639\u0631\u0627\u0642 \u0628\u0639\u0636 \u0627\u0644\u0645\u0648\u0627\u062f \u0645\u0646\u0647\u0627:","ansO":"\u0627\u0644\u0646\u0641\u0637","ansT":"\u0627\u0644\u062a\u0645\u0648\u0631","ansTh":"\u0627\u0644\u0623\u0644\u0627\u062a","ansF":"\u0627\u0644\u063a\u0627\u0632 \u0627\u0644\u0637\u0628\u064a\u0639\u064a","corr":"3"},{"question":"\u064a\u0628\u0644\u063a \u0639\u062f\u062f \u0633\u0643\u0627\u0646 \u0644\u064a\u0628\u064a\u0627 :","ansO":"\/3.5\/ \u0645\u0644\u064a\u0648\u0646 \u0646\u0633\u0645\u0629","ansT":"\/4\/ \u0645\u0644\u064a\u0648\u0646 \u0646\u0633\u0645\u0629","ansTh":"\/5\/ \u0645\u0644\u064a\u0648\u0646 \u0646\u0633\u0645\u0629","ansF":"\/5.5\/ \u0645\u0644\u064a\u0648\u0646 \u0646\u0633\u0645\u0629","corr":"4"}],

I debugged the code and discovered that it doesn’t enter inside, it moves directly to the end

before I made some modifications to the code, the array was filled,
what could be the problem?

  • 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-01T13:07:02+00:00Added an answer on June 1, 2026 at 1:07 pm

    if the JSON file contains a syntax error, the request will usually fail silently. So add .error method and check if there is any error in parsing json

    // Assign handlers immediately after making the request,
    // and remember the jqxhr object for this request
    var jqxhr = $.getJSON("example.json", function() {
      alert("success");
    })
    .success(function() { alert("second success"); })
    .error(function() { alert("error"); })
    .complete(function() { alert("complete"); });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: $(document).ready(function(){ $.ajax({ url: svc/GetTweetsByUser.php, type: POST, success: function(data) {
I have the following code: $(document).ready(function() { var id = 'cbx'; var idPrefix =
I have the following code $(document).ready(function() { $('a#slick-toggle').click(function() { $('#slickbox0').toggle(400); return false; }); });
I have the following code: $(document).ready(function(){ $(.yearInner).hide(); $(.year, this).hover( function () { $(.yearInner, this).slideToggle();
I have the following code: $(document).ready(function() { // Manage sidebar category display jQuery(#categories >
I have the following JQuery code: $(document).ready(function () { var $containerHeight = $(window).height(); if
I have the following code to enable validation work: $(document).ready(function() { $(#eventForm).validate({ rules: {
Under $(document).ready(function() , I have the following code: num = $(#mainContentCategoryLinksWrapper > div).size(); This
I have the following code: <script> $(document).ready(function() { $('.toggle_section').click(function(e){ parent = $(e.target).closest(div) objChild =
I have using the following code for developing tabs. $(document).ready(function() { $('#container-1').tabs(); } ....

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.