diff --git a/frappe/public/js/frappe/request.js b/frappe/public/js/frappe/request.js index 8589b3f256..cdb792da90 100644 --- a/frappe/public/js/frappe/request.js +++ b/frappe/public/js/frappe/request.js @@ -50,15 +50,19 @@ frappe.request.call = function(opts) { type: 'POST', dataType: opts.dataType || 'json', statusCode: { + 200: function(data, xhr) { + if(typeof data === "string") data = JSON.parse(data); + opts.success && opts.success(data, xhr.responseText); + }, 404: function(xhr) { msgprint(__("Not found")); }, 403: function(xhr) { msgprint(__("Not permitted")); }, - 200: function(data, xhr) { + 417: function(data, xhr) { if(typeof data === "string") data = JSON.parse(data); - opts.success && opts.success(data, xhr.responseText); + opts.error && opts.error(data, xhr.responseText) }, 501: function(data, xhr) { if(typeof data === "string") data = JSON.parse(data);