Home >Web Front-end >JS Tutorial >jQuery plug-in ajaxFileUpload realizes the effect of asynchronous file upload_jquery

jQuery plug-in ajaxFileUpload realizes the effect of asynchronous file upload_jquery

WBOY
WBOYOriginal
2016-05-16 16:04:151140browse

ajaxFileUpload is a jQuery plug-in for asynchronous file upload.

Upload a version I don’t know, so you don’t have to look for it everywhere in the future.

Syntax: $.ajaxFileUpload([options])

Options parameter description:

1. url Upload handler address. ​
2. fileElementId    The ID of the file field that needs to be uploaded, that is, the ID of .
3. secureuri Whether to enable secure submission, the default is false.
4. dataType The data type returned by the server. Can be xml, script, json, html. If you don't fill it in, jQuery will automatically determine it.
5. success is a processing function that is automatically executed after successful submission. The parameter data is the data returned by the server.
6. error A processing function that is automatically executed if the submission fails.
7. data Custom parameters. This thing is more useful. When there is data related to the uploaded image, this thing will be used.
8, type When you want to submit custom parameters, this parameter must be set to post

Error message:

1, SyntaxError: missing; before statement error
If this error occurs, you need to check whether the url path is accessible
2. SyntaxError: syntax error
If this error occurs, you need to check whether there is a syntax error in the server background handler that handles the submission operation
3. SyntaxError: invalid property id error
If this error occurs, you need to check whether the text field attribute ID exists
4. SyntaxError: missing } in XML expression error
If this error occurs, you need to check whether the file name is consistent or does not exist
5. Other custom errors

You can use the method of directly printing the variable $error to check whether each parameter is correct, which is much more convenient than the invalid error prompts above.

The above is the entire content of this article, I hope you all like it.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn