Skip to content
Loading
Semantic/Foundation/Bootstrap Validation  
  •   
  • class="form-group">  
  • class="control-label col-sm-3" for="PType">Product Type  
  • class="col-sm-2">  
  • "text" class="form-control form-control-sm" id="txtPType" placeholder="Product Type">  
  •   
  •   
  •   
  •   
  • class="modal-footer">  
  • "button" class="btn btn-primary" id="btnAdd" onclick="return Add();">Save  
  • "button" class="btn btn-primary" id="btnUpdate" style="display:none;" onclick="Update();">Update  
  • "button" class="btn btn-warning" data-dismiss="modal">Cancel  
  •   
  •   
  •   
    1. function Add() {  
    2. var res = validate();  
    3. if (res == false) {  
    4. return false;  
    5. }  
    6. var objLocation = {  
    7. Id: $('#txtId').val().toUpperCase(),  
    8. Description: $('#txtDescription').val().toUpperCase(),  
    9. IsActive: $('#txtIsActive').val().toUpperCase()  
    10. };  
    11. $.ajax({  
    12. url: "/Location/Add",  
    13. data: JSON.stringify(objLocation),  
    14. type: "POST",  
    15. contentType: "application/json;charset=utf-8",  
    16. dataType: "json",  
    17. success: function (data) {  
    18. //loadData();  
    19. $('#tblLocation').DataTable().ajax.reload();  
    20. $.notify(data.message, {  
    21. globalposition: "top center",  
    22. //position:"center",  
    23. className:"success"  
    24. })  
    25. $('#myModal').modal('hide');  
    26. },  
    27. error: function (xhr, ajaxOptions, thrownError) {  
    28. alert("Error");  
    29. $("#msgModalBody").html('Status : ' + xhr.status + ' Error : ' + thrownError);  
    30. $("#msgModal").modal('show');  
    31. //  
    32. }  
    33. });  
    34. }  
    Thanks

    1 Reply

    Know the answer? Post it — somebody with the same question will find it here.