title: SyntaxError: Unexpected token W in JSON at position 0
body: <p>I am sending POST Request with API in JavaScript and I have already made many POST Requests with this following method but now this is showing the error:
  <strong>SyntaxError: Unexpected token W in JSON at position 0</strong></p>
  
  <p>Here is my code-</p>
  
  <pre><code>function updateAlertSetting(data_json, callback){
  
  var firebase_token = getCookie("firebase_token");
  if(firebase_token===null){
      window.location.href="login.html";
      return;
  }
  var base_64_firebase_token = btoa(firebase_token);
  
  console.log(typeof data_json);  // Object
  console.log(data_json);         // prints the data_json
  
  $.ajax(
      {
          type: 'POST',
          url: getApiURL(28),
          data: {
                  "alertSetting_value": data_json.alertSetting_value,
                  "alertSetting_name": data_json.alertSetting_name,
                  "firebase_token": data_json.firebase_token
                },
          headers: { "Authorization": "Basic " + base_64_firebase_token },
          success : function(newData){
              callback(newData);
          },
          error: function (xhr,ajaxOptions,throwError){
              console.log(throwError);
              console.log("Error!!!");
          }
      }
  );
  }
  </code></pre>