well, i tried some options more... it turns out when i set ajax data
type to "text" and convert it to json object using json.parser() it
works just fine. ok then its solved but i should be able to pass data
as a json object between two functions, right?

On Jan 23, 4:24 pm, blockedmind <blockedm...@gmail.com> wrote:
> it returns
> uncaught exception TypeError: Cannot read property 'length' of
> undefined
> error on google chrome's javascript debug window.
>
> let me put here the full scenario:
>
> var listsData="";
> function getLists() {
>     $.ajax({
>        type: "POST",
>        url: "actions.php",
>        data: "action=managelists",
>        success: function(returnedLists){
>          listsData = returnedLists;
>          printLists("ID","ASC");
>        }
>     });}
>
> function printLists(sortBy,sortOption) {
>     //$('#listlist .listdata').html(listsData);
>     listsData=listsData['list'];
>     $.each(listsData,function (a,b,c) {
>         alert (b.id + ',' + b.name);
>     });
>
> }
>
> so getList() function can successfully get the data i have wrote in
> the first message. it is assigned to listsData and also passed
> successfully to printLists function.
> can it be the reason that i do not use dataType: "json" in the
> getLists function? or what else? it seems so correct but it doesnt
> work. :/
>
> On Jan 22, 7:18 am, seasoup <seas...@gmail.com> wrote:
>
> > or...
>
> > $.each(theList.list,function (a,b) {
> >   alert (b.id + ',' + b.name);
>
> > })
>
> > On Jan 21, 7:30 pm, Ami <aminad...@gmail.com> wrote:
>
> > > I think that this what R U searching for:
>
> > > var theList={"list":[
> > > {"id":"15","name":"Testing","description":"test","owner":"1","active":"1","featured":"0","machinename":"testing"},
> > > {"id":"16","name":"Testing","description":"test","owner":"1","active":"1","featured":"0","machinename":"testing"},
> > > {"id":"17","name":"Testing","description":"test","owner":"1","active":"1","featured":"0","machinename":"testing"}
> > > ]};
>
> > > theList=theList['list'];
> > > $.each(theList,function (a,b,c)
> > > {
> > > alert (b.id + ',' + b.name);
>
> > > })
>
> > > On Jan 22, 4:46 am, blockedmind <blockedm...@gmail.com> wrote:
>
> > > > I have data recieved by ajax function of jquery like:
> > > > {"list":[
> > > > {"id":"17","name":"Testing","description":"test","owner":"1","active":"1","featured":"0","machinename":"testing"},
> > > > {"id":"16","name":"Another
> > > > List","description":"Another","owner":"1","active":"1","featured":"0","machinename":"another-
> > > > list"},
> > > > {"id":"15","name":"Listenin
> > > > Adı","description":"Yeah.","owner":"1","active":"1","featured":"0","machinename":"listenin-
> > > > adi"},
> > > > ]};
>
> > > > how can i print each "list" in aloop? i tried many variations,
> > > > couldn't get the result.

Reply via email to