Message from JavaScript discussions

October 2020

— You can simply understand fetch as a way to ask your server information. You can fetch(url) and tell your server to do something based on the URLs. By default, getting a PHP file will (probably) call it and send the result to the browser.

Message permanent page

— 

Understanding HTTP is important though. Otherwise you will end up as php developer wondering why some requests both populate $_GET and $_POST.

— So fetch("db.php?sql=select * from TABLE") will ask for "db.php" setting the ?sql somewhere in the PHP (probably the $_GET variable) and you'll have to process the input in the db.php file and echo something out.

Message permanent page

— Totally agree, but I am a firm believer in "first make it work, then understand why"

— I wonder how you explain telephones to your children 👀

— Also little complicated thing: fetch is async, so this means that it doesn't just return a value, it instead returns a Promise (that is, a wrapper for a value that can either contain it or tell you it is being processed.) To use it easily you'll have to prepend the call with await (that calls the promise and waits until it's done)

Message permanent page

— A) I'm the child here
B) I mean, here's a phone. You can call other people with it. You can play games. You also always want to be near me when you use it (we don't want the kids into porn, do we?). Wonder why? Try and figure it out yourself. Can't tell? Alright! Here's why *opens wikipedia*

Message permanent page

— *sigh* I just lost all motivation to explain stuff

— I think ...as I am beginner...so I should use form tag for that

— Reply expert please

— Reply me

—