Skip to content

Instantly share code, notes, and snippets.

@santiago
Created July 29, 2010 19:57
Show Gist options
  • Save santiago/499066 to your computer and use it in GitHub Desktop.
Save santiago/499066 to your computer and use it in GitHub Desktop.
$.widget("ui.choose_your_needs", {
_init: function() {
var $el= this.element;
$el.find("#need-groups .need-group-box").need_group_box();
$el.find("#next-step").click(function() {
var json= [];
$el.find("[name=need_id]:checked").each(function() {
json.push($(this).val());
});
$.post("/cyn/choose-your-needs", {nsbg: $.toJSON(json)}, function(data) {
if (data==[]||data=="") { // it gets [] but parses as "", dunno why
$el.trigger("next-step");
}
});
});
}
});
$.widget("ui.cyn", {
_init: function() {
var self= this;
var $el= this.element;
this._load_current_step();
$(".cyn-step").live("reload", function() {
self._load_step($(this).attr("id"));
});
$("#next-step").live("click", function() {
self._next_step();
});
....
_next_step: function() {
this._load("/cyn/next-step?current_step=\""+this._current_step().replace("cyn-","")+"\"");
},
...
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment