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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:00:15+00:00 2026-06-11T10:00:15+00:00

I have this JSON: { jsonDept: [ { Id: 1, DeptName: aaaa }, {

  • 0

I have this JSON:

{
  "jsonDept": [
    {
      "Id": "1",
      "DeptName": "aaaa "
    }, {
      "Id": "2",
      "DeptName": "bbb "
    }, {
      "Id": "6",
      "DeptName": "ccc "
    }, {
      "Id": "7",
      "DeptName": "ddd "
    }, {
      "Id": "8",
      "DeptName": "eee "
    }, {
      "Id": "9",
      "DeptName": "fff "
    }, {
      "Id": "12",
      "DeptName": "haha "
    }, {
      "Id": "13",
      "DeptName": "test1 "
    }, {
      "Id": "14",
      "DeptName": "test2 "
    }, {
      "Id": "10",
      "DeptName": "tmd "
    }, {
      "Id": "11",
      "DeptName": "tnnd "
    }
  ]
}

And my JQuery:

function loadDepartmentList() {
    $.ajax({
        url: "QueryDepartment.ashx",
        //data: "",
        type: "GET",
        dataType: 'json',
        success: function (data) {
            // how to read json here? this is not working
            $.each(data, function () {
                alert("Name: " + this.DeptName);
            });
        }
    })
}

but alert shows “undefined”, and only popup once.

What I want to do is parse this json, and generate html <ul><li>DeptName</li></ul> and put the html into a div.

I googled many codes, they are not working. I think it may be the problem with the begining string “jsonDept”.

Can anyone write a working script for this json? Thanks!

  • 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-11T10:00:17+00:00Added an answer on June 11, 2026 at 10:00 am

    The returned object contains one property, that is jsonDept. It is the jsonDept property which contains the array of department information.

    function loadDepartmentList() {
        $.ajax({
            url: "QueryDepartment.ashx",
            //data: "",
            type: "GET",
            dataType: 'json',
            success: function (data) {
                // how to read json here? this is not working
                $.each(data.jsonDept, function () {
                    alert("Name: " + this.DeptName);
                });
            }
        })
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this json returned from my ajax call [ {message:haha, type:error}, {message:nice work,
i have this JSON object: {error:null, result:[{id:1234567890, count:1, recipients: [u3848, u8958, u7477474 ], dateCreated:2012-06-13T09:13:45.989Z
I have this JSON http://www.progmic.com/ielts/retrive.php that I need to parse. When I do it
I have this JSON (which validates according to JSONLint ): [ { "BugCount":"2", "BugTitle":"C:\\INETPUB\\WWWROOT\\CLUBREADY2\\TRAINERS\\../Connections/LTC.asp",
I have this json object : { msg_id:134, message:Dick, comment:[ { com_id:9, comment:test, msg_id:134,
I have this JSON response string: {d:{\ID_usuario\:\000130\,\Nombre\:null,\Vipxlo\:0,\Provmun\:null,\Descuentos\:null,\Listaviplocal\:null}}` With this code: - (void)connectionDidFinishLoading:(NSURLConnection *)connection {
I have this JSON and you can see under products i have barcodes for
I have this json string: $row['medium'] = {\medium\:13|17|1|14, \medium_sub\:21}; now I want to make
I have this json which populates my collection ( TableListCollection ) of models (
i have this JSON: var projects_array = new Array( {name:myName1, id:myid1, index:1}, {name:myName2, id:myid2,

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.