Edit in JSFiddle

nativeAdRequest = function() {
  var xhr = new XMLHttpRequest();
  var data = JSON.stringify({
    "placements": [{
      "divName": "div1",
      "networkId": 23,
      "siteId": 667480,
      "adTypes": [5],
      "properties": [],
      "contentKeys": []
    }],
    "flightViewTimes": [],
    "keywords": []
  });
  $.ajax({
    url: "https://e-23.adzerk.net/api/v2",
    dataType: 'json',
    method: "POST",
    success: function(data, status, xhr) {
      console.log("SUCCESS!!!", data);
      
      // record the impression; REQUIRED
      console.log("Impression URL: ", data.decisions.div1.impressionUrl, "\n");
      $.ajax({url: data.decisions.div1.impressionUrl, method: "GET"});

      // log & display the response
      console.log("Adzerk response", data.decisions.div1);
      console.log("Click URL: ", data.decisions.div1.clickUrl);         
      $("#response").text(JSON.stringify(data.decisions.div1));
      $("#div1").replaceWith(data.decisions.div1.contents[0].body)
    },
    error: function(data, status, xhr) {
      console.log("ERROR!!!", data, status)
    },
    data: data
  });
};