index.html.tera 730 B

1234567891011121314151617181920212223242526272829303132
  1. {% extends "base.html.tera" %}
  2. {% block content %}
  3. <div class="container">
  4. <p><!--Nothing to see here --></p>
  5. <button onclick="get_vid(1)"> Gachi </button>
  6. <button onclick="get_vid(2)"> Anime </button>
  7. <button onclick="get_vid(3)"> Drum & Bass </button>
  8. </div>
  9. <script lang='js'>
  10. function get_vid(type_id) {
  11. axios({
  12. method:'get',
  13. url: `/shitpost/${type_id}`
  14. })
  15. .then((response) => {
  16. // handle success
  17. window.open(response.data.url, "_blank").focus();
  18. })
  19. .catch((error) => {
  20. // handle error
  21. console.log(error);
  22. })
  23. }
  24. </script>
  25. {% endblock content %}