method="post" work in Sololearn? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

method="post" work in Sololearn?

I'm trying to submit my form using post method in Sololearn but it's not working,like it's not saving submitted information on my server

16th Jul 2020, 4:10 PM
Prasad Shinde
Prasad Shinde - avatar
17 Answers
+ 2
Yes, it works from Sololearn as long there is a connected server. Please share your code.
16th Jul 2020, 4:15 PM
Calviղ
Calviղ - avatar
+ 1
For cross domain access, your server needs to enable CORS.
16th Jul 2020, 4:31 PM
Calviղ
Calviղ - avatar
0
It works on heroku website but not in Sololearn
16th Jul 2020, 4:19 PM
Prasad Shinde
Prasad Shinde - avatar
0
I have a form post request to my Glitch.com server, it works very well. https://code.sololearn.com/Wj7yW7R4iSId/?ref=app
16th Jul 2020, 4:21 PM
Calviղ
Calviղ - avatar
0
You have any idea what's wrong in my shared code?
16th Jul 2020, 4:23 PM
Prasad Shinde
Prasad Shinde - avatar
0
For form submit, event.preventDefault() is needed.
16th Jul 2020, 4:40 PM
Calviղ
Calviղ - avatar
0
Hi thnx i already enabled cors,but it was not working on heroku but it worked for glitch idk why 😂 still not working
16th Jul 2020, 4:42 PM
Prasad Shinde
Prasad Shinde - avatar
0
If i use prevent default then use will stay on form page and maybe they will send it multiple times
16th Jul 2020, 4:46 PM
Prasad Shinde
Prasad Shinde - avatar
0
Try to add fetch with .then(response => response.json()).then(data => console.log(data)).catch( e => console.log("error " + e.message)) To debug any error on fetch.
16th Jul 2020, 4:56 PM
Calviղ
Calviղ - avatar
16th Jul 2020, 4:57 PM
Prasad Shinde
Prasad Shinde - avatar
0
Ok i will try that
16th Jul 2020, 4:57 PM
Prasad Shinde
Prasad Shinde - avatar
0
Server app.post of '/postQuote' should response a json from callback back to client for acknowledgement.
16th Jul 2020, 5:01 PM
Calviղ
Calviղ - avatar
0
Ooh yeah i will try that i was not sending any response
16th Jul 2020, 5:04 PM
Prasad Shinde
Prasad Shinde - avatar
0
When i make post request and catch err it's showing TypeErro: failed to fetch
16th Jul 2020, 5:33 PM
Prasad Shinde
Prasad Shinde - avatar
0
I ended up using iframe (-_-)
16th Jul 2020, 6:06 PM
Prasad Shinde
Prasad Shinde - avatar
0
Post method is more secure although but when you click on submit the back-end part (web application server and the database ) comes in the part of Nest JS.Take the course of Angular +Nest JS on sololearn before working on back-end part.
16th Jul 2020, 6:08 PM
shubham kumar
shubham kumar - avatar