Skip to content

Instantly share code, notes, and snippets.

@santiago
Created July 29, 2010 20:10
Show Gist options
  • Save santiago/499099 to your computer and use it in GitHub Desktop.
Save santiago/499099 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= [];
var click= this;
$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
$(click).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("next-step", function() {
self._next_step();
});
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment