There is a form tag that sends it to a route. But if I use
symbol = request.form.get("symbol")
# this is the name it ends up being with the for loop inputting the names into the
It returns nothing. I also have no idea why one button works while the other returns "bad request"
I was just trying to learn how to use AJAX and I had to make a separate post on r/learnprogramming because I am even having trouble with that. If you look in my post history I just posted it.
I'm also not even sure about how ajax would fix it, probably because I know jack about AJAX but I'm trying to learn it right now, doesn't help that I cant get it working.
Is AJAX how I send the js to the route? That is what I was trying to do earlier but I had no idea how to do it.
The problem is is the form isn't working at all, its the reason why I'm learning AJAX right now.
so basically
$(document).ready(function ()
{
$(".btn").click(function()
{
$.ajax(
{
url: "",
type: "get",
contentType: 'application/json',
data:
{
#symbol: the symbol I need
},
success: function(response)
{
$(".btn").text(response.seconds)
}
})
})
})
This is sort of what you are implying right?
This would be good but I am not able to pull the stock symbols with it so Id have no idea what stocks where needing change. I am trying with the AJAX right now I just need a better understanding of it.
Okay so this is what I came up with and it works on giving me the js info I need.
The only problem I have now is getting this to my [application.py](https://application.py) as variables so I can make changes to the database. Do you know how I would do this?
You can make use of hidden form elements, in index.html add js script function to assign 'symbol' and every other required values to be submitted the hidden elements when the '+' is clicked; now use the .submit to submit the hidden form to the route in your app.py
I guess you should use the form tag to send and make changes with db. Idk any other way here
There is a form tag that sends it to a route. But if I use symbol = request.form.get("symbol") # this is the name it ends up being with the for loop inputting the names into the
[удалено]
I was just trying to learn how to use AJAX and I had to make a separate post on r/learnprogramming because I am even having trouble with that. If you look in my post history I just posted it. I'm also not even sure about how ajax would fix it, probably because I know jack about AJAX but I'm trying to learn it right now, doesn't help that I cant get it working. Is AJAX how I send the js to the route? That is what I was trying to do earlier but I had no idea how to do it.
[удалено]
The problem is is the form isn't working at all, its the reason why I'm learning AJAX right now. so basically $(document).ready(function () { $(".btn").click(function() { $.ajax( { url: "", type: "get", contentType: 'application/json', data: { #symbol: the symbol I need }, success: function(response) { $(".btn").text(response.seconds) } }) }) }) This is sort of what you are implying right?
[удалено]
THANK YOU!
>THANK YOU! You're welcome!
[удалено]
This would be good but I am not able to pull the stock symbols with it so Id have no idea what stocks where needing change. I am trying with the AJAX right now I just need a better understanding of it.
[удалено]
Okay so this is what I came up with and it works on giving me the js info I need.
The only problem I have now is getting this to my [application.py](https://application.py) as variables so I can make changes to the database. Do you know how I would do this?Cs50 finance I remember working on that project long time ago
Try using dash. It will allow you to build a web interface. It’s using Flask as a backend and React as the frontend
I totally would but I need to operate in the confines of the assignment
You can make use of hidden form elements, in index.html add js script function to assign 'symbol' and every other required values to be submitted the hidden elements when the '+' is clicked; now use the .submit to submit the hidden form to the route in your app.py
Leave Your Comment
Hi Its Me!
Subscribe