title: How to send byte array to server side using AJAX
body: <p>forgive me if this question is too silly or already asked I googled a lot but I didnt get anything I want. I need to pass a byte array to server side using ajax but its not working as planned my current code is given below </p>
  
  <pre><code>var bytes = [];
  
  for (var i = 0; i &lt; data.length; ++i) {
      bytes.push(data.charCodeAt(i));
  }
  
  $.ajax({
      url: '/Home/ImageUpload',
      dataType: 'json',
      type: 'POST',
      data:{ data:bytes},
      success: function (response) {
          alert("hi");
      }
  }); 
  </code></pre>
  
  <p>Upload Method</p>
  
  <pre><code>    [HttpPost]
      public ActionResult ImageUpload(byte[] data)
      {
                  ImageModel newImage = new ImageModel();
                  ImageDL addImage = new ImageDL();
                  newImage.ImageData = data;
                  addImage.AddImage(newImage);
                  return Json(new { success = true });
  
      }
  </code></pre>
  
  <p>I know something wrong with my program but I cant find it please help me to solve this </p>