Sunday 20 October 2019

Is using 'location.assign' a bad idea for a get request

Using express for reference.Context: Basically I'm rendering a list (via ajax front end) but at this point I'm not using any href's for each list item. Instead if the item is clicked it is grabbing a dataset value. That works and I can send the request from axios to express and get my data back. It's a 'GET' request since I have no form elements in the list.Problem: So the item that is retrieved requires a good amount of html. I think it might be better to just use a pug template on the back end and have express render it (instead of front end rendering). The problem is with the way things are set up (no hrefs) the only way I figured out to make it work is doing a location.assign('/route/id').It works but I have a sneaking suspicion that it maybe a bad practice.tl;dr: Is using location.assign a bad idea for sending a 'GET' request ?

Submitted October 20, 2019 at 02:24PM by fickentastic

No comments:

Post a Comment