Mixing JavaScript and Scala in a Play template

前端 未结 1 1773
离开以前
离开以前 2021-01-05 16:06

I\'m not sure how this is done. I could hard code the route I\'m trying to use, but I\'d like to do this the right way.

I have a dropdown that needs to load a new pa

相关标签:
1条回答
  • 2021-01-05 17:08

    You need a way of storing all URLs in the page, e.g.

    <option value="@routes.Accounts.transactions(id)">Display</option>
    

    Then onChange, you can:

    $("select[name='product']").change(function() {
      location.href = $(this).val();
    });
    
    0 讨论(0)
提交回复
热议问题