Q:

How to access JSON data in AJAX method?

How do access data I have encoded from a PHP to in a $ajax() method?
My question mainly is what to use as a variable and what should be the value of the data attribute? Here is the code that I have so far. I am new to AJAX and I would appreciate an answer, thanks in advance. 
$dcweather = array('weather' => "$DCfahrenheit", 'wind' => "$DCwind", 'humidity' => "$DChumidity");
$jsonCode = json_encode($dcweather);
echo ($jsonCode);

('#button_dc').click(function() {
  var data = {
    weather: "$DCfahrenheit",
    wind: "DCwind",
    humidity: "DChumidity"
  }

  $.ajax({
    type: 'POST',
    url: 'DCweather.php',
    data: data,
    dataType: 'json',
    success: function(result) {
      consol.log(result);
      $('#div_new').replaceWith(result);
    }
  });
});

A:

From the code above result would be a object with the indices of weather, wind, and humidity. 
So:
result.weather would be whatever $DCfahrenheit was set to on the server.
However, the typo of consol.log(result) with throw an error, and no further code will be processed.

