Hey folks, I’m working on a project that uses a jQuery UI drag-n-drop system to add/remove widgets from a profile. The database has flags corresponding to profile widgets; a controller checks the flags, sends them to widgets in a view, and the widgets decide whether or not to render. The page I’m working on has a list of checkboxes for widgets and a submit button to update the database with enabled/disabled values.
Now, how would I handle this with AJAX? I can use use standard jQuery AJAX, something like…
$.post("http://mysite/member/profile",$("#shownWidgets").serialize(),function(data){
alert(data);
});
…but that left me scratching me head as to how to render the widget, without having a page refresh. Does Yii have any - er - magical powers that help with this? I was considering making a view for each widget, then rendering each view in the profile (which doesn’t seem terribly efficient); this way I could call a ‘render widget view’ action in the profile and insert the returned data in the page somewhere, but that seems sloppy…