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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:08:13+00:00 2026-05-29T10:08:13+00:00

This is the response to my ajax call. I want to handle each array

  • 0

This is the response to my ajax call. I want to handle each array element to update the title of a corresponding button on my page that has the value of the Letter element. I need to replace the alert(response); with a loop over the json array.

{“COLUMNS”:[“PAGESNUM”,”LETTER”],”DATA”:[[“372″,”A”],[“922″,”B”],[“779″,”C”],[“3‌​78″,”D”],[“132″,”E”],[“353″,”F”],[“551″,”G”],[“591″,”H”],[“6″,”I”],[“340″,”J”],[“‌​261″,”K”],[“314″,”l”],[“837″,”M”],[“88″,”N”],[“120″,”O”],[“303″,”P”],[“14″,”Q”],[“‌​355″,”R”],[“762″,”S”],[“235″,”T”],[“12″,”U”],[“44″,”V”],[“581″,”W”],[“49″,”Y”],[“‌​19″,”Z”]]}

$.ajax({
    type: "Get",
    url: "cfc/basic.cfc?method=CountUsersByLetter&returnformat=json",
    data: "nbw=" + nbw,
    datatype: "html",
    success: function (response) {
        //usercount = parseInt(response.substring(0, 10));
        ///$(_$this.target).attr('title', usercount);
        alert(response);
    },
    error: function (xhr, textStatus, errorThrown) {
        alert('errorThrown');
    }
});

  • 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-29T10:08:14+00:00Added an answer on May 29, 2026 at 10:08 am

    javascript is case sensitive, so you’re going to want to make that parameter dataType and if you’re getting JSON back, then don’t tell jQuery that you’re expecting “html”

     dataType: "json",
        success: function (response) {
            alert(response.DATA[0][1]);//should alert "A"
        }
    

    If you need to do some looping, your arrays are response.COLUMNS and response.DATA (which is an array of arrays).

    var numCols = response.COLUMNS.length;
    for( var i = 0; i < numCols; i++ ){
        response.COLUMNS[i]
    }
    

    or to loop over the nested array

    var numData = response.DATA.length;
    for( var i = 0; i < numData; i++ ){
        for( var j = 0; j < response.DATA[i].length; j++ ){
            response.DATA[i][j]
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to include an AJAX call within a .submit() handler so that I
In @mmalc's response to this question he states that In general you should not
I'm using a repeater on my page. I want to populate this repeater based
In the event of a successful AJAX call I want to return a simple
I want to create an AJAX call on an action, let's call it seen,
On this site each page is made up of multiple .jsp files. There is
Greetings, I have a jqueryui autocomplete input that uses an ajax call to populate
I want to make an AJAX call to a file on a server, from
This is giving me headaches, AGAIN. I either don't understand this ajax response stuff
I want to make an ajax call from jQuery to my server. Basically, I

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.