how can i write the javascript equivalent for curl code?

I took your curl command and put it into this website:

You can change the url from google to your localhost

var url = "";

var xhr = new XMLHttpRequest();"POST", url);

xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

xhr.onreadystatechange = function () {
   if (xhr.readyState === 4) {

var data = "dataRequest=demo1";


CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top