Sunday, April 30, 2023

Ajax form submit MVC

@using (Ajax.BeginForm("ApproveBatchCollectSheet", "CollectionSheet", new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "result", OnComplete = "OnComplete" }))


 


@using (Ajax.BeginForm("Action", "ControllerName", new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "result", OnComplete = "OnComplete" }))

{


  <div class="modal-footer">

        <button type="submit" tabindex="@maxTabIndex" class="btn btn-primary btn-approve-batch-cs"><i class="fa fa-check"></i> Collect</button>

        <button type="button" tabindex="@maxTabIndex" id="btnCloseModal" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-times"></i> Close</button>

    </div>

}




<script>

    function OnComplete(xhr, status, error) {

        //alert(xhr.responseText);

        $.alert.open(xhr.responseText);

         

        $('#GlobalPopupModal').modal('toggle');

        //reload grid data

        CollectionSheetManager.GetCollectionSheetList();

    }

</script>








No comments:

Post a Comment

Screen Record

 Windows Screen Record WindowsKey+ Alt + R Recording Starts.