Home >Web Front-end >JS Tutorial >Jquery ajaxsubmit upload image implementation code_jquery
And no unified upload function has been established. So the code was modified. I thought about using ajax to upload pictures asynchronously. This technology should be very old-fashioned. So I directly opened the powerful cnblogs and easily found this article. I directly followed the example and directly "used" the fruits of the author's labor. The entire code was quickly transformed. But the problem came when I published the program to the server. The uploaded file failed! Sweat~ It’s all the consequences of laziness. Continue to open the article you referenced earlier. It turns out that the author explained that it can only be used locally and cannot be published to the server. I wonder if I still have to use the depressing method of iframe http post? ?
So I was unwilling to open the more powerful Google and started searching around the world for solutions. Finally, the hard work paid off. "jquery.form.js" was found.
The steps to upload images asynchronously are as follows:
1. Reference the jquery js framework (the benefits of this need not be discussed) and then reference "jquery.form.js".
2. Create a general handler ashx.
The core code is as follows:
html: