YUI-RPC example with flickr

This example uses the Flickr SMD to generate the form using inputEx.RPC.generateServiceForm.

The request is handled by YUI-RPC (using jsonp), which callbacks to our simple viewing method.

Results :

			var service = new Y.inputEx.RPC.Service("flickr.smd",{ 
				success: function() {

					// Creates the form from service.getPublicPhotos method
					Y.inputEx.RPC.generateServiceForm(service.getPublicPhotos, { parentEl: 'container1' },{
							success: function(results) {
							  
								// Get the result and display the images
								var treeContainer = Y.one('#photos');
								treeContainer.innerHTML = "";
								var list = results.photos.photo;
								for(var i = 0 ; i != list.length-1 ; i++) {
									var photo = list[i];
									var url = "http://farm"+photo.farm+".static.flickr.com/"+photo.server+"/"+photo.id+"_"+photo.secret+"_m.jpg";
									treeContainer.appendChild( Y.inputEx.cn('div', {className: 'photo'}, null, String.fromCharCode(60)+"img src='"+url+"' /"+String.fromCharCode(62) ) );
								}	

							}
						});

				}
			});