Home > Web Front-end > JS Tutorial > body text

Related issues such as parameter submission not updating during ajax upload_Basic knowledge

WBOY
Release: 2016-05-16 17:46:51
Original
1479 people have browsed it

Previously, I downloaded a jQuery Ajax upload plug-in from the Internet. The left side of the web page is the upload category. The function I want to implement is as follows: I originally planned to create different folders based on the upload category on the server side to save it. file, so this requires passing an upload classification parameter to the background. These upload categories are read from the database and generated using repeater. When one of the categories is clicked, a style is set for it, and the name of the category is saved in a variable uploadCatlog. I can get the classification and pass it to the backend, but the strange thing is that it is correct only the first time, and the parameters are not updated every time thereafter. In fact, uploadCatlog is also used in the onComplete callback function of the upload plug-in, and its value has been updated. I feel like this upload plug-in is only instantiated when clicked for the first time and the parameters are passed to the background, so the values ​​will remain unchanged in the future. How should I solve this problem? The following are the details of my js code:
JavaScript code:

Copy code The code is as follows:



Later I found a solution, that is: after creating the instance, it will not change. You can call the SetData method in the onSubmit callback function to set dynamic parameters. The following code and comment details:
JavaScript code:
//You can use these methods to configure AJAX upload
var upload = new AjaxUpload('#div_id',{action: 'upload.php'} );
//For example, when the user selects something and sets some parameters
upload.setData({ ”catlog”:
Ajax upload parameters are always submitted due to various errors. A problem occurs, but how to solve the problem and how to use the best method to solve the problem is a problem worthy of further study. If you want to solve the problems that arise during the programming process, you still need to continue to study and learn!
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!