Skip to content

Javascript

Getting started with Javascript

To use the API with Javascript use the following example

Using Fetch

    var myHeaders = new Headers();
    myHeaders.append("Content-Type", "application/json");

    var raw = JSON.stringify({
    "api_key": "777XXXXXXXXXXXXXXXXXXXAWVwNpSM=",
    "pc": "HOME006"
    });

    var requestOptions = {
    method: 'POST',
    headers: myHeaders,
    body: raw,
    redirect: 'follow'
    };

    fetch("https://apiv1.pataa.com/get-pataa", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

Using Jquery

  var settings = {
    "url": "https://apiv1.pataa.com/get-pataa",
    "method": "POST",
    "timeout": 0,
    "headers": {
        "Content-Type": "application/json"
    },
    "data": JSON.stringify({
        "api_key": "777XXXXXXXXXXXXXXXXXXXAWVwNpSM=",
        "pc": "HOME006"
    }),
    };

    $.ajax(settings).done(function (response) {
    console.log(response);
   });