Hi I trying to return alert using json success but when file is not image and click save, it go into if (!allowedExtensions.Contains(checkextension)) but it return blank page with {"success":false,"responseText":"file is not image type"} with url http://localhost:63551/Home/SaveUpdateData
I tried change to JsonResult action but still the same. I don't know where gone wrong
<div> </div> <div> <div class="modal fade" id="updateModal" role="dialog"></div> <div> <div class="modal-dialog"></div> <div> <div class="modal-content" id="updateModalContent"></div><div> <div></div> <div> <div class="modal-header"></div> <div> <button type="button" class="close" data-dismiss="modal">×</button></div> <div> </div></div> <div> @if (Model.BoothModelCollection != null)</div> <div> {</div> <div> @*@using (Html.BeginForm("SaveUpdateData","Home", FormMethod.Post, new</div> <div> {</div> <div> id = "submitForm",</div> <div> onsubmit = "return AjaxPostUpdate(this)",</div><div> enctype = "multipart/form-data",</div> <div> @class = "AddBooth"</div> <div> }))</div> <div> {*@</div> <div> <form id="submitForm" action="Home/SaveUpdateData" class="AddBooth" method="post" enctype="multipart/form-data" onsubmit="return AjaxPostUpdate(this)"></div> <div> </div><div> <div class="modal-body" style="width:50%;position: relative;margin: auto"></div> <div> <div class="form-group"></div> <div> <div class="widget-user-image" id="Image" style="max-width:300px;max-height:300px"></div></div> <div> <div class="input-group" style="margin-top:10px"></div> <div> <label for="imgInpUpdate" class="btn btn-primary btn-block btn-outlined"></div> <div> <i class="glyphicon glyphicon-folder-open" style="margin-right: 5px"></i></div><div> Choose image</div> <div> </label></div> <div> <input type="file" name="files" id="imgInpUpdate" style="display: none" /></div> <div> </div></div> <div> </div></div> <div> <div class="form-group"></div><div> <label>Booth ID</label></div> <div> <div class="input-group"></div> <div> <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span></div> <div> <input type="text" class="form-control" id="BoothID" name="BoothID" readonly="readonly"></div> <div> </div></div> <div> <span asp-validation-for="BoothModelInputDetail.BoothID" class="text-danger"></span></div> <div> </div></div> <div> <div class="form-group"></div> <div> <label asp-for="BoothModelInputDetail.BoothName"></label></div> <div> <div class="input-group"></div><div> <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span></div> <div> <input type="text" class="form-control" id="BoothName" name="BoothName"></div> <div> </div></div> <div> <span asp-validation-for="BoothModelInputDetail.BoothName" class="text-danger"></span></div> <div> </div></div> <div> <div class="form-group"></div> <div> <label asp-for="BoothModelInputDetail.Description"></label></div><div> <textarea id="Description" class="form-control" rows="5" placeholder="Enter ..." name="Description"></textarea></div> <div> <span asp-validation-for="BoothModelInputDetail.Description" class="text-danger"></span></div> <div> </div></div> <div> <div class="form-group"></div> <div> <label asp-for="BoothModelInputDetail.BoothType"></label></div><div> <div class="input-group"></div> <div> <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span></div> <div> <select class="form-control BoothType" name="BoothType" id="DropDwn" style="width: 230px"></div> <div> <option></option></div> <div> <option value="Booth">Booth</option></div> <div> <option value="Booth 2">Booth 2</option></div> <div> <option value="Booth 3">Booth 3</option></div> <div> </select></div> <div> </div></div> <div> <span asp-validation-for="BoothModelInputDetail.BoothType" class="text-danger"></span></div> <div> </div></div> <div> <div class="form-group"></div> <div> <label asp-for="BoothModelInputDetail.Quantity" class="control-label"></label></div> <div> <div class="input-group"></div> <div> <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span></div><div> <input type="text" class="form-control" id="Quantity" name="Quantity"></div> <div> </div></div> <div> <span asp-validation-for="BoothModelInputDetail.Quantity" class="text-danger"></span></div> <div> </div></div> <div> </div></div> <div> <div class="modal-footer" style="padding: 30px"></div> <div> <button type="button" id="btnClose" class="btn btn-default" data-dismiss="modal" style="float:left">Close</button></div><div> <button type="submit" id="btnSave" class="btn btn-default">Save</button></div> <div> </div></div> <div> </form></div><div> //}</div> <div> }</div> <div> </div></div> <div> </div></div> <div> </div></div> <div> </div></div>