title: jQuery ajax Call upload File return json / text from C# ASP.NET
body: <p>I have a jquery ajax call that uploads a file of such:</p>
  
  <pre><code>            &lt;input type="file" id="imgFileUpload" name="imgFileUpload"/&gt;
  
              var formData = new FormData($('form')[0]);
              formData.append("imgFileUpload", $('#imgFileUpload').get(0).files[0]);
  
              $.ajax({
                      type: "POST",
                      processData: false,
                      contentType: false,
                      url: myUrl,
                      data: formData,
                      success: function(data) {
  
                              alert(data);          //pops up "Object XMLDocument"
                              alert(data.d);        //pops up "undefined"
  
                      },
                      error: function (err) {
                          alert("ERROR: " + err.responseText);
                      }
                  });
  </code></pre>
  
  <p>I then searched for another solution, I've found that when you add the following to your ajax call:</p>
  
  <pre><code>dataType: 'text',
  </code></pre>
  
  <p>You get to receive a string back but now the returned string is XML-like, to be specific it returns the following:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
    &lt;string xmlns="http://tempuri.org/"&gt;
        success
    &lt;/string&gt;
  </code></pre>
  
  <p><strong>the thing is that I need only the string <code>success</code> itself</strong></p>
  
  <p>Usually I have no problem with returning a string from C# to ajax but since in this scenario I am working with a <code>formData</code> I must define in my ajax call both : 
  <code>processData</code> and <code>contentType</code> to be <code>false</code>.</p>
  
  <p>In conclusion, I need to send an input file and return a string to the <code>success(data)</code></p>
  
  <p>Please help me conquer that flag... any help'd be much appreciated !!</p>