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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:27:19+00:00 2026-05-25T21:27:19+00:00

This is my sample JSON response: [{id:11137,name:Agra},{id:11138,name:Albizzate}] and i need to iterate each array

  • 0

This is my sample JSON response:

[{"id":11137,"name":"Agra"},{"id":11138,"name":"Albizzate"}]

and i need to iterate each array object and print id and name:

        $.ajax({
            url: '{{ path('ajax_provinces') }}',
            type: 'POST',
            dataType: 'json',
            data: {region_id: this.value},
            success: function(provinces) {},
            error: function() { alert("error"); },
            complete: function(provinces) {
                $('select#regions ~ span > img').fadeOut('slow');
                $.each(provinces, function(key, val) {
                    alert(key + ": " + val);
                });
            }
        });

The problem is i’m gettig strange results: function names, function bodies and other internal stuff from jQuery. It seems like it’s iterating through jQuery library functions! Any clue what’s going on?

  • 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-25T21:27:19+00:00Added an answer on May 25, 2026 at 9:27 pm

    The problem is that the complete callback doesn’t get passed the returned data as an argument:

    complete(jqXHR, textStatus)

    A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request (“success”, “notmodified”, “error”, “timeout”, “abort”, or “parsererror”).

    (from the docs)

    Presumably the weird key/values you’re seeing are the attributes of the jqXHR object.

    You need to handle the returned data in success, not complete. My understanding is that complete is generally used for actions that should happen regardless of whether the AJAX request successfully returned data (e.g. hiding a loading animation).

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

Sidebar

Related Questions

My JSON response looks like this : {sample:[{id:2,name:branch name},{id:3,name:branch name 2}]} My function looks
My JSON response looks like this : {sample:[{id:2,name:branch name},{id:3,name:branch name 2}]} My function looks
a sample of json response looks like this: {publicId:123,status:null,partner:null,description:null} It would be nice to
I need to create a map/array for auto complete from a JSON response and
I have this sample text, which is retrieved from the class name on an
I've written this sample code to print the length of x. But for some
I'm trying to deserialize sample JSON at the end of this question with below.
In my application I have the array, which create in Main_View_Controller from json response
Imagine this sample java class: class A { void addListener(Listener obj); void removeListener(Listener obj);
Consider this sample code: <div class=containter id=ControlGroupDiv> <input onbeforeupdate=alert('bingo 0'); return false; onclick=alert('click 0');return

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.