Monday, March 22, 2021

New Beginnings (again)

 I feel like I need to start this again. I know no one would really read this but I need a way to document things I learn. I have gotten into some coding again. I started making a documentation system last year and got to a point where I could try uploading it to AWS but had to put that on pause. Been a very busy since the last post. Started a helpdesk job at a different company. Took a trip to The Netherlands. Trying to learn Hindi. Busy getting everyone working from home at my job due to Covid. I developed a board game to a point that I'm somewhat happy with it. The game will just need a few more tweaks and play testing with those changes and maybe it can go to market someday. When the pandemic comes to an end I might be able to take it to some shops for people to play.

Just last week I started on an efficiency application to track how productive I am being. And thus why I want to start back at keeping track this way. Here is a problem I was having yesterday and how I resolved it.

I have a Flask application and on the one page I want to do an AJAX request. The AJAX request seemed to work as there were no errors. However, the page would always reload when clicking submit, so maybe the AJAX request wasn't going through. Through testing I found out that since the data was in a form, the form was being submitted to the backend before the AJAX request would ever be made. I removed the form tags and just used input fields with individual ids. The AJAX request would then send the data in those two fields to the backend.

I feel there is a better way to implement this as I believe form data can be sent through an AJAX request, but that might be for another day as this setup seems like it will work for this use case.

25 words or less: Having input fields not inside form tags can potentially make AJAX requests simpler.

No comments:

Post a Comment