Skip to content

Instantly share code, notes, and snippets.

@Ravenna
Created July 11, 2016 16:27
Show Gist options
  • Select an option

  • Save Ravenna/61ab6050e935b129b7816da27cc4a30e to your computer and use it in GitHub Desktop.

Select an option

Save Ravenna/61ab6050e935b129b7816da27cc4a30e to your computer and use it in GitHub Desktop.
$.ajax({
type: "POST",
url: link,
data: data,
success: function(response){
console.log('Default Entity Updated');
},
error: function(data){
var errors = data.responseJSON;
var i = 1;
$.each(errors, function(key, value){
var input = $('input[name='+ key +']');
if(i === 1){
input.focus();
}
input.addClass('error');
input.parents('.form-group').append('<span class="entity-note">'+ value +'</span>');
i++;
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment