0

I want to display data in the value field of dictionary using Ajax. I know the format to display, but stuck in displaying one of the fields. Code is here :

$.each(result, function(index, element) {
      alert(element.Place);
      alert(element.Unique Name);
   });

element.Unique Name doesn't work as there is a space in between( It is Unique Name not UniqueName). Could you guys help me out displaying this?

UserRA
  • 185
  • 1
  • 2
  • 16

1 Answers1

1

Fiddle for your answer

    var data = {
    "employees": [{
        "firstName": "John",
        "Unique Name": "Doe"
    }, {
        "firstName": "Anna",
        "Unique Name": "Smith"
    }, {
        "firstName": "Peter",
        "Unique Name": "Jones"
    }]
};

$.each(data, function (index, element) {
    alert(index);
    $.each(element, function (inde, data1) {
        alert(inde);
        alert(data1.firstName);
        alert(data1['Unique Name']);
    });
});

I think it may meet your requirements. plz let me know if works.

Abhishek
  • 452
  • 3
  • 19