<li id="bapvm"></li>
  • <blockquote id="bapvm"></blockquote>

    <thead id="bapvm"><del id="bapvm"></del></thead>

    <thead id="bapvm"></thead>
  • <thead id="bapvm"><del id="bapvm"></del></thead>
      <thead id="bapvm"><del id="bapvm"></del></thead>
    1. laravel 返回ajax请求错误信息

      laravel 创建验证的 表单请求( form request )  执行命令 php artisan make:request StoreBlogPostRequest

      分享图片

       

       

      前段ajax发送请求 

       
      $(‘#reg_reg‘).click(function () {
              var formData = new FormData($( "#reg_form" )[0]);
              var url = "{{ url(‘/admin/register‘) }}";
      
              $.ajax({
                  headers: {
                      ‘X-CSRF-TOKEN‘: $(‘meta[name="csrf-token"]‘).attr(‘content‘)
                  },
                  url: url,
                  type: ‘POST‘,
                  data: formData,
                  cache: false,
                  contentType: false,
                  processData: false,
                  success: function(res){
                      console.log(res);
                      // if(res.code){
                      //     redirect_success(res.msg, res.url)
                      // }else{
                      //     error(res.msg);
                      // }
                  },
                  error : function (msg ) {
                      var json=JSON.parse(msg.responseText);
                      $.each(json.errors, function(idx, obj) {
                          alert(obj[0]);
                          return false;
                      });
                  },
              })
          })
      相关文章
      相关标签/搜索
      香港摇钱树精选一肖