title: How to display responseText from the return object in jquery
body: <p>I have Jquery code</p>
  
  <pre><code>  $('#add_companies').click( function(e) {
      var form_id   = '#'+ $(this).parents('form').attr('id');
      var result    = do_submit(form_id);
      console.log(result);
    });
  </code></pre>
  
  <p>The code get the data from the form given by the form id and do the submit, using </p>
  
  <pre><code>do_submit()
  </code></pre>
  
  <p><strong>do_submit() function</strong> </p>
  
  <pre><code>function do_submit(form_id) {
    var url         = $(form_id).attr("action");
    var ajax_result = false;
  
    // Submit form using ajax
    ajax_result = $.ajax({
      type: "POST",
      url: url,
      data: $(form_id).serialize(),
      dataType: 'json',
      success: function(result) {
        return result;
      },
      error: function(result) {
          // code here
        });
      },
    });
  
    return ajax_result;
  } // End do_submit()
  </code></pre>
  
  <p>after the successful submit, it return an object stored in <code>result</code> with this data</p>
  
  <pre><code>Object {readyState: 1}
  abort: function(a)
  always: function()
  complete: function()
  done: function()
  error: function()
  fail: function()
  getAllResponseHeaders: function()
  getResponseHeader: function(a)
  overrideMimeType: function(a)
  pipe: function()
  progress: function()
  promise: function(a)
  readyState: 4
  responseJSON: 1
  responseText: "1"
  setRequestHeader: function(a,b)
  state: function()
  status: 200
  statusCode: function(a)
  statusText: "OK"
  success: function()
  then: function()
  __proto__: Object
  </code></pre>
  
  <p>when I try to get the value of <code>result</code> responsetext in this format</p>
  
  <pre><code>result.responseText
  </code></pre>
  
  <p>console says </p>
  
  <pre><code>undefined
  </code></pre>
  
  <p>how to properly get the responseText?</p>