title: Get Int value from Controller to $.Ajax
body: <p>I want to pass int value from controller and check if it is greater than 0 in $.ajax. I don't know how to do it. I have tried a code but it is giving me undefined value. Going data in controller is working fine. But returning int value not able to do.:</p>
  
  <p>AJAX Code:</p>
  
  <pre><code>function bindForm(dialog,urlString) {
      $('form', dialog).submit(function () {
      var data_send = $(this).serializeArray();
      $.ajax({
          url: urlString, 
          type: this.method,
          data: $(this).serialize(),
          success: function (result) {
          alert(result.success);
          if (parseInt(result.success, 10) &gt; 0) {
              alert('Details Added Successfully');
              $('#dialog-form').dialog('close');
              var hdnInvoiceId = document.getElementById("Invoice_Id");
              hdnInvoiceId.value = parseInt(result.success, 10);
              $('#addInvoiceDetail').hide();
              } else {
              alert('Please Re-enter Details');
              bindForm();
              }
          }
      });
      return false;
  });
  </code></pre>
  
  <p>Controller Code:</p>
  
  <pre><code>[HttpPost]
  public int AddInvoice(Invoice model)
  {
      int Invoice_Id = CRMServiceDL.insertInvoiceDetail(model);
      int success;
      if (Invoice_Id &gt; 0)
      {
          success = Invoice_Id;
      }
          else {
          success = -1;
  
      }
      return success;
  }
  </code></pre>