title: Returning String Result from Ajax Method
body: <p>I have a DoughnutChart chart and I would like to change the color of its parts regarding color hexa-codes saved in the database I used this Ajax method to get the color string by invoking an action method that returns JSON Result , </p>
  
  <pre><code>    getcolors: function getcolors(name) {
      return $.ajax({
          url: "/api/ideas/getcolors",
          data: { name: name },
          type: "GET",
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: function (data, textStatus, jqXHR) {
             // return  data;
          },
          error: function (data) {
            // return  "Failed";
          },
          async: true
      });
  </code></pre>
  
  <p>but instead of receiving the string I received Object {readyState: 1} in the console window <a href="https://i.stack.imgur.com/lhYZ0.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/lhYZ0.jpg" alt="enter image description here"></a></p>
  
  <p>However, I can find the color value stored in ResponseText element.I need your help in how can I get the color value as string.</p>
  
  <p><strong>EDIT :</strong> </p>
  
  <p>To make things more clear that's where I would like to invoke the ajax method to receive the color string then I will be able to push in the chart color array .</p>
  
  <pre><code>getColorArray: function getColorArray(categories) {
          var colors = [];
          for (var i = 0; i &lt; categories.length; i++) {
              console.log(this.getcolors("Risk"));
              //colors.push(this.getcolors(categories[i]));
          }
  
          return colors;
      }
  </code></pre>