Skip to content

Commit

Permalink
FIX commented string
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammedAlbalaawi committed Aug 30, 2022
1 parent 119e57d commit a278ff3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 27 deletions.
5 changes: 1 addition & 4 deletions app/Http/Controllers/DepartmentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ public function store(StoreDepartmentRequest $request)
{
Department::create($request->all());

// session()->flash('success', 'Author successfully created!');

return response()->json(['success' => 'Added successfully'],200);
//return new JsonResponse(['data'=>'Added successfully'],200);
return response()->json(['success' => 'Added successfully'], 200);
}
}
27 changes: 4 additions & 23 deletions resources/views/departments/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,40 +53,21 @@
url: "{{route('departments.store')}}",
type:'POST',
data: {_token:_token,name:name},
//dataType: 'json',
//contentType: false,
success: function(response) {
if(response) {
$('#nameSc').text(response.success);
}
},
error: function(reject) {
var errors = $.parseJSON(reject.responseText);
$.each(errors.errors, function (key, val) {
var errors = $.parseJSON(reject.responseText); // get array of all errors
$.each(errors.errors, function (key, val) {
$("#" + key + "_error").text(val[0]);
});
}
});
});
function printErrorMsg (msg) {
$.each( msg, function( key, value ) {
console.log(key);
$('.'+key+'_err').text(value);
});
}
});
});
</script>
Expand Down

0 comments on commit a278ff3

Please sign in to comment.