Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('#name').keypress(function(e) {
- if(e.which == 13) {
- e.preventDefault();
- jQuery(this).blur();
- jQuery('#save').click();
- }
- });
- $("#save").click(function(e){
- $("#addManufacturerForm").submit(function(e){
- e.preventDefault();
- });
- var form = $('#addManufacturerForm');
- var url = form.attr('action');
- var method = form.attr('method');
- var data = form.serialize();
- $.ajax({
- type: method,
- url: url,
- data: data,
- datatype: 'json',
- encode: true,
- success: function(json){
- var response = JSON.parse(json);
- if(response.status == 'success'){
- // $('#addManufacturer').modal('hide');
- console.log(response.status);
- alert('success');
- location.reload();
- } else {
- alert(response.message);
- }
- }
- }
- )
- .done(function(result){
- $("#name").val("")
- console.log(result);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment