Hi,

I'm having an issue with Mojolicious and the stash and I think I'm probably 
just not understanding the way it works? I have a page with 2 combo boxes 
and when the first entry changes I wish to update the options in the second.

So I add an event handler like below, which then calls my controller sub 
routine 'devicecommandset' and then puts the result of a DBIx query into an 
array of hashes which I add to my stash.

I am then just render some benign text. My subroutine gets called and there 
is the expected contents in '@commandsets'. However I cannot see it in the 
stash on the browsers console ( I'm running in debug mode ).

Do I need to actually modify the DOM for the stash to be populated? 
Basically I'm just trying to get data back from my request to fill the 
combobox options.

In my template

$(document).ready(function() {

 $('select:not([name*="command"])').live('change', function (e) {
     $.get('devicecommandset', { device: $(this).attr("value") },
          function (data) {
                alert("Made it this far");
           });
      });         
 });

In my Controller

sub devicecommandset {
  my $self = shift;
  my $device = $self->param('device') || '';
  my @commandsets = 
$self->db->resultset('CommandSet')->search_commandsets_by_devicename($device); 
  $self->stash(commandsets => \@commandsets );
  print Dumper(@commandsets);
  $self->render(text => 'success' );
 }

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to