Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clever frontend js, but is it necessary? #28

Open
BartBucknill opened this issue Dec 15, 2017 · 0 comments
Open

Clever frontend js, but is it necessary? #28

BartBucknill opened this issue Dec 15, 2017 · 0 comments

Comments

@BartBucknill
Copy link

You have:

button.addEventListener('click', function(e){
    var tag = e.target.textContent.replace(' ', '-');
    window.location.href='/result/'+tag;

in your frontend js. I've not seen this before, and I definitely learnt something. But is it necessary?
Given that you have the page redirecting/refreshing anyway, I think you could just accomplish the same thing with an html form, using input type of 'checkbox' and method set to 'get'. If I'm right, then by doing this you could avoid having any frontend js.

If on the other hand you wanted to avoid refreshing/redirecting the page, you could make an xhr request and populate the page using frontend dom manipulation when the response comes back. However, you are not currently doing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant