jQuery $.each() - Array of Objects

前端 未结 4 1820
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-15 00:21

I am trying to perform jQuery each function on something like:

\"RelatedDoc\": [
    {
        \"Id\": \"test\",
        \"Number\": \"26262316\"
    }
],
         


        
4条回答
  •  野的像风
    2021-02-15 00:41

    Here is my problem and what i solved. Use firebug. this is Array Object. Which is use to create four check boxes.

    [
        {"datamet":"1","vchAmenityName":"TV"},
        {"datamet":"2","vchAmenityName":"Cable TV"},
        {"datamet":"5","vchAmenityName":"Internet"},
        {"datamet":"7","vchAmenityName":"Air Conditioning"}
    ]
    
    
    
    
    
    

    i have to find this inside first. Means to check the element inside it like below [{"datamet":"2"}]

    For this i did following .. i got the problem solved

    $.each(result, function(idx, obj){ 
        $.each(obj, function(key, value){
            console.log(key + ": " + value);
        });
    });
    

提交回复
热议问题