Alvin Alvin - 3 months ago 14x
Javascript Question

Using REST API and send POST request

POST localhost:5000/registrar

"enrollId": "jim",
"enrollSecret": "6avZQLwcUe9b"

How do I use this in a javascript file? Do I use JSON or JQuery? And how do I invoke the request function in .html?


Use jquery for this:

<script src=""></script>

And call function


    $.post('localhost:5000/registrar', {
      "enrollId": "jim",
      "enrollSecret": "6avZQLwcUe9b"
    }, function(serverResponse){

    //do what you want with server response