anam
anam

Reputation: 3913

array transverse in ajax return

I am storing Array in Js file , using ajax i get the whole array , who can i get transverse Array ?

$.ajax({
                type : "GET",
                url : "string-en.js",
                dataType : "script",
                 success: function(data) {

                    console.log('data is '+data);
                    //label=data;
                     $(data.d).each(function(){
                       alert(this)
                        });
                 }
            });

Return ::

data is a = {"Hi":"Hi","By":"By" }; 

Upvotes: 0

Views: 71

Answers (1)

bipen
bipen

Reputation: 36531

try this

$.each(data,function(i,v){
        alert(v);
});

or if you data is a then

$.each(data.a,function(i,v){
        alert(v);
});

Upvotes: 2

Related Questions