Validation errors in AJAX mode

前端 未结 8 874
盖世英雄少女心
盖世英雄少女心 2021-01-30 00:14

Currently I use this to display validation errors via ajax:

            if (data.validation_failed == 1)
            {
                var arr = data.errors;
            


        
8条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-30 01:00

    In the ajax response trying something like

        .fail(function( data ) {
            var response = JSON.parse(data.responseText);
            var errorString = '
      '; $.each( response.errors, function( key, value) { errorString += '
    • ' + value + '
    • '; }); errorString += '
    ';

提交回复
热议问题