in reply to Loading values into template using Perl and Mojolicious::Lite

From looking at Mojolicious::Guides::Tutorial, it seems that you should ->stash before you ->render. Also, you should be able to pass your parameters directly in your call to ->render:

$c->render(template => 'magic', two => 24);

Replies are listed 'Best First'.
Re^2: Loading values into template using Perl and Mojolicious::Lite
by Anonymous Monk on Mar 31, 2017 at 18:30 UTC
    Yes, you're right the first one works, but the second does not, I wonder if it has to do with the " return $->render(json => $data ); code.

      You call ->render twice there. That doesn't make sense to me.

        I did, to try loading the template again, but there no need for that I realized. The "/get_status" route gets call by ajax once the page loads.Could that be the issue?
        # Load value into Main template, # but I cant get the results to display on the template. # $c->render( # template => 'main', # ); # this is the tag in the template <TMPL_VAR NAME="result"> $c->stash( result => ' This is the result for testing' ); # I also return json from the sql query results, which it was called + from ajax # and it works fine. return $c->render(json => $data );
        But it still doesn't work.