title: Jquery and Ajax Error Message cannot Display in Laravel Blade
body: <p>I Insert Ledger Record using Ajax and Jquery in Laravel. Success Message has been Displayed Correctly but Error Custom Message Cannot Display in blade View. Whats My Mistake Please Mention.</p>
  
  <p><strong>Jquery :</strong></p>
  
  <pre><code>$("#add").click(function(event) {
    event.preventDefault();
  
    $.ajax({
      type: 'post',
      url: $("#add").attr('data-url'),
      data: {
        '_token': $("input[name=_token]").val(),
        'form_data': $('#Form').serialize(),
      },
      success: function(data) {
        $('#ledger_name').val('');
        $('#openning_balance').val('');
        $('#ob_type').val('');
        $('#under').val('');
        $('#ledger_address').val('');
        $("#newLedger .close").click();
  
        $(".result").html(data.success).css({
          'color': 'green',
          'text-align': 'center'
        }).delay(5000).fadeOut();
      },
      error: function(data) {
        $('#response').show().html(data.error).css({
          'color': 'red',
          'text-align': 'center'
        }).delay(5000).fadeOut();
      }
    });
  });
  </code></pre>
  
  <p><strong>Controller :</strong></p>
  
  <pre><code>$values = array();
      parse_str($_POST['form_data'], $values);
  
      $validation = $this-&gt;validator($values,true );
      if($validation-&gt;fails()){
      $errors = $validation-&gt;errors();
      return response()-&gt;json(['error' =&gt; 'Please Fill all Mandatory Fields',],500);
      }
  
      $insertledgers=Ledger::create(['ledger_name'=&gt;$values['ledger_name'],'openning_balance'=&gt;$values['openning_balance'],'ob_type'=&gt;$values['ob_type'],'under'=&gt;$values['under'],'ledger_address'=&gt;$values['ledger_address'],'company_id'=&gt;$companyids,'user_id'=&gt;$usersid,'created_by'=&gt;$usersid]);
  
      $ledgerinsertids=$insertledgers-&gt;id;
  
      if($values['ob_type'] == 'Cr'){
  
      $creditamts=$values['openning_balance'];
      $debitamts= 0;
  
      } else {
  
      $creditamts=0;
      $debitamts= $values['openning_balance'];
  
      }
  
      $insertledgeropenningbalance=Openningbalance::create(['ledgerid'=&gt;$ledgerinsertids,'opening_credit'=&gt;$creditamts,'opening_debit'=&gt;$debitamts,'company_id' =&gt; $companyids,'user_id' =&gt; $usersid,'created_by' =&gt; $usersid,]);
  
      return response()-&gt;json(['success' =&gt; 'Ledger Details Added Successfully',],200);   
  </code></pre>