app/assets/javascripts/thin_man.js in thin_man-0.11.2 vs app/assets/javascripts/thin_man.js in thin_man-0.11.3
- old
+ new
@@ -168,10 +168,21 @@
this.progress_indicator = new thin_man.AjaxProgress(this.progress_target,this.target,this.progress_color);
}
},
ajaxError: function(jqXHR) {
if(jqXHR.status == 409){
- this.error_target.html(jqXHR.responseText);
+ try{
+ var data = JSON.parse(jqXHR.responseText);
+ }catch(error){
+ var data = jqXHR.responseText;
+ }
+ if(typeof data === 'string'){
+ this.error_target.html(data);
+ } else if(typeof data === 'object') {
+ if(typeof data.html != 'undefined'){
+ this.error_target.html(data.html);
+ }
+ }
}else if(jqXHR.status == 500){
alert('There was an error communicating with the server.')
}
},
getTrigger: function(){},