File Upload via AJAX within JQuery

前端 未结 5 1736
迷失自我
迷失自我 2020-11-27 21:50

I am new to JQuery AJAX . I want to implement a file upload using a jquery. Will it be possible to make a fileupload with JQuery,AJAX and send it to Servlet which can use ap

5条回答
  •  有刺的猬
    2020-11-27 22:11

    Ajax in the traditional sense is XMLHttpRequest, which does not allow you encode and send local files to a server.

    The common ways of doing uploading through "ajax" means, is to either use a Flash swf to handle the uploading on the same page, or to use a form that has a target of an invisible 1x1 iframe. You have some Javascript show a uploading spinner or whichever. After the file is uploaded, make the server return some Javascript to the iframe like

    
    

    top will allow you to call Javascript in the regular page. In order for that to work though, you must make sure the iframe has submitted to the same domain that the top document is located at.

提交回复
热议问题