Hello,
I try to cycle through an ajax-json-response, but it isn''t working.
May someone have a look to my sample or may post some other code,
which is working?
Big thanks,
Micha
here the source-class:
var DynamicList = Class.create({
initialize: function (sourceURL,offset, itemCount, element,
templateString) {
this.url = sourceURL;
this.offset = offset;
this.limit = itemCount;
this.tempList = {};
},
getItems: function(offset, limit) {
var s = new Ajax.Request(this.url + ''?limit='' + limit +
''&offset''+offset, {
method: ''get'',
onSuccess: function(transport,json) {
this.tempList = $H(json);
this.handleResponse();
}.bind(this)
});
return true;
},
handleResponse: function() {
this.tempList.result.each(function(item) {
alert(item);
});
}
});
Here der Server response for the ajax-request (X-JSON-Header):
X-JSON {"list":{"1":{"name":"pos:
1"},"2":{"name":"pos: 2"},"3":
{"name":"pos: 3"},"4":{"name":"pos:
4"},"5":{"name":"pos: 5"},"6":
{"name":"pos: 6"},"7":{"name":"pos:
7"},"8":{"name":"pos: 8"},"9":
{"name":"pos: 9"}}}:
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---