[jQuery] reloading new objects from json
I've got a ajax request that grabs a json response.
In order to be able to sort and get data from the response, I put the
response into a few objects using
[code]
function(jsondata){
var dates={};
var ids={};
$.each(jsondata.entry, function(){
if(!ids[this.id])
ids[this.id] = [];
ids[this.id].push(this);
if(!dates[this.date])
dates[this.date] = [];
dates[this.date].push(this);
});
for(var d in dates){
var date=d;
$('div#holddates').append('<ul class="dayList" id="'+date
+'"><li class="date" >'+date+'</li></ul>');
$.each(dates[date], function(){
$('ul#'+date).append('<li class="cal" id="'+this.id
+'">'+this.name+'</li>');
});
}
[/code]
When a user clicks on one of the dates, i go back to the json and get
a location from the id object
[code]
$('li.show').livequery('click', function(){
var getSid=$(this).attr('id');
alert(getSid);
$.each(bids[getSid], function(){
alert(this.name);
});
});
[/code]
All of this code works the first time I get an ajax response, however,
if I make another ajax request, the first portion loads (so I get the
list with the id and name), but if I click that name, I seem to not
get access to the object again.
The first alert does show the correct id is being clicked, but I can't
seem to get past that.
Whats I found very strange is that if I pass the object into the
livequery function, then it always fails, even on the first response.