File upload is part of many web applications but badly supported by browsers. The biggest problem is the lack of feedback of the upload status, while any action of the users disrupts the upload. A simple progress bar could improve the feedback but requires quite some work on the server side, while the problem of disruptive actions remains.
To improve the situation, file uploads should be performed in the background. This allows the application to continue accepting other user input.
The jQuery form plugin makes it trivial to switch from the native browser upload to Ajax background uploading. With this form:
However, just doing the upload in the background without any feedback of the completed upload isn’t enough, so we use the success option to display an alert about the successful upload:
The ajax Form method binds itself to the submit event of the form, which allows it to also include the button used to submit the form in the Ajax request. The latter isn’t available when using ajax Submit. The ajax Submit method is useful on its own when the form submit is handled elsewhere, for example, by the validation plugin. To integrate validation and Ajax submit,ajax Submit should be used in the submit Handler option:
In addition to the alert, the clear Form method, also provided by the form plugin, removes all values from the form. This makes it easy for the user to upload another file.
J Query Related Interview Questions
|HTML 4 Interview Questions||HTML Interview Questions|
|HTML 5 Interview Questions||Zend Interview Questions|
|JqueryUI Interview Questions||Dynamic HTML Interview Questions|
|XQuery Interview Questions||jQuery Mobile Interview Questions|
J Query Related Practice Tests
|HTML 4 Practice Tests||HTML Practice Tests|
|HTML 5 Practice Tests||Zend Practice Tests|
|PHP and Jquery Practice Tests||J Query Practice Tests|
|CodeIgniter Practice Tests||Dynamic HTML Practice Tests|
J Query Tutorial
Selecting Elements With Jquery
Beyond The Basics
Faster, Simpler, More Fun
Html Form Enhancements From Scratch
Html Form Enhancements With Plugins
Interface Components From Scratch
User Interfaces With Jquery Ui
Jquery Ui Theming
Jquery, Ajax, Data Formats: Html, Xml, Json, Jsonp
Using Jquery In Large Projects
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.