最近做一个全ajax的web项目,在注册提交表单时,除了其他,另外还要上传图片.
如果没有图片的上传,用jquery
?
??????? $("#login-form").submit(function(event) {
??????????? /* stop form from submitting normally */
??????????? event.preventDefault();
???????????
??????????? /* Send the data using post and put the results in a div */
??????????? $.post( requestURL, {
??????????????? "username": username,
??????????????? "password": password
??????????? },function(data) {
???????????????????? //
??????????????? }
??????????? });
??????? });
?
便可以搞定了,现在要上传图片,,这个就不行了.google了一下,发现jquery-form-plugin这个插件不错,20kb.
具体可以参考官网: http://www.malsup.com/jquery/form/#getting-started
这里也是一个教程:? http://www.web-development-blog.com/archives/jquery-form-plugin-and-php-file-uploads/
?
希望有用.
?