From 1de6d9282c207db804c9674e705f98c33ed4abc0 Mon Sep 17 00:00:00 2001 From: Vit Date: Sat, 22 Sep 2012 19:39:19 +0400 Subject: [PATCH] api submit: replace $.post with $.ajax --- src/js/bootstrap-editable.js | 11 +++++++---- test/api.js | 1 - 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/js/bootstrap-editable.js b/src/js/bootstrap-editable.js index 4890395..e9b97fd 100644 --- a/src/js/bootstrap-editable.js +++ b/src/js/bootstrap-editable.js @@ -464,8 +464,12 @@ if(config.data) { $.extend(values, config.data); } - $.post(config.url, values, 'json') - .success(function(response) { + $.ajax({ + type: 'POST', + url: config.url, + data: values, + dataType: 'json' + }).success(function(response) { if(typeof response === 'object' && response.id) { $elems.editable('option', 'pk', response.id); $elems.editable('markAsSaved'); @@ -475,8 +479,7 @@ } else { //server-side validation error config.error.apply($elems, arguments); } - }) - .error(function(){ //ajax error + }).error(function(){ //ajax error config.error.apply($elems, arguments); }); } else { //client-side validation error diff --git a/test/api.js b/test/api.js index 6f75ac8..d33b936 100644 --- a/test/api.js +++ b/test/api.js @@ -234,7 +234,6 @@ $(function () { $(fx).find('.new').editable('submit', { url: 'new.php', error: function(data) { - console.log(data); ok(data.errors, 'errors defined'); equal(data.errors.text, 'invalid', 'client validation error ok'); }