diff --git a/ajax_list.js b/ajax_list.js index 6ab6ca6..0fb2624 100644 --- a/ajax_list.js +++ b/ajax_list.js @@ -210,7 +210,7 @@ $=jQuery; after_list=options.after_list; - after_list(); + after_list(data.rows); } diff --git a/posting2.js b/posting2.js index 9a7e624..f612a2c 100644 --- a/posting2.js +++ b/posting2.js @@ -1,4 +1,4 @@ - +$=jQuery; (function( $ ){ @@ -58,6 +58,16 @@ } } + beforeSend=false; + + if(options.hasOwnProperty("before_send")) { + + beforeSend=options.before_send; + console.log('Send before...'); + + } + + $(this).on('submit', function (e) { //Get data of form @@ -108,6 +118,7 @@ cache:false, contentType:false, processData: false, + beforeSend: beforeSend, success: function (data) { $(options.loading).hide(); @@ -116,6 +127,12 @@ if(!data.hasOwnProperty("error_csrf")) { + + if(options.hasOwnProperty("error")) { + + options.error(data); + + } if(data.hasOwnProperty("csrf_token")) @@ -129,9 +146,11 @@ console.log('Error'); if(data.hasOwnProperty('error_form')) - { + { + console.log('Showing errors in form...'); + for(i in data.error_form) { - + $(i).html(data.error_form[i]); $(i).show();