javascript - ajax upload file after choose file auto submit -
I tried uploading Ajax and I do not want to submit a submit button. If you choose to auto-submit the file, simply give it to the user.
I tried to use change ()
to get the form data change, but after clicking it a second time it will not give warning only once, I do not know why, There is no better idea to do this work!
HTML
& lt; Div class = "article-create" & gt; & Lt; Table class = "table" & gt; & Lt; TD & gt; & Lt; Form action = "" enctype = "multipart / form-data" method = "post" & gt; & Lt; Input type = "file" name = "image" class = "browseimage" & gt; & Lt; / Form & gt; & Lt; Li class = "Browse-Fake BTN BTn-Success BTN-SM" & gt; Select file & lt; / Li & gt; ('Click', '.browseimage-fake', function () (
js
$ ('. {$ (This). ('.td'). ('.browseimage'). Click (); $ (this) .closest ('td'). ('. {Warning (' change '); // check formadata and ajax .. }};});
Try this code alert only calls once :
$ (document) .on ('change', '.browseimage', function () {alert ('change'); // check form data and ajax..}); < / Code>
Comments
Post a Comment