DEV Community

Discussion on: Building a Simple URL Shortener With Just HTML and Javascript

Collapse
 
bauripalash profile image
Palash Bauri 👻

For Sending Json Request, I created a function with XMLHttpRequest() (Code)

(Actually I have changed the storage provider so APIs are little different but understandable)

First, we open a new connection to your storage provider, then tell them that we are going to send json data.
Then create a JSON Object something like this {"l":<LONG_URL> , "s": <SHORT_URL_SLUG>} then send the json object to my JSONBOX endpoint (yes, I have switched to jsonbox from jsonstore).