#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2017
    Posts
    15
    Rep Power
    0

    My ajax is not clearing modal data on submit.


    Hi how can this be changed so that once I submit the form in the modal it will be empty to enter another item. At the moment if I add another item it still has the last insert data still there.
    I am using ajax:
    Code:
     success:function(data){  
         $('#insert_form')[0].reset();  
         $('#add_data_Modal').modal('hide');  
         $('#invoice_table').html(data);  
        }  
       });
    Even if I remove the data in the input fields and put in new items it still gives me errors saying it is empty.

    Thanks - have been searching ajax site but can't find anything that works.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2017
    Posts
    7
    Rep Power
    0
    You may try with setTimeout
    PHP Code:
         setTimeout(function(){ 
         $(
    '#insert_form')[0].reset();  
         $(
    '#add_data_Modal').modal('hide'); 
    }, 
    1000); 

IMN logo majestic logo threadwatch logo seochat tools logo