鉴于这种形式
<form id="posts_form">
<input type="file" value="" name="picture" >
<span class="picture_js fc-button fc-button-prev fc-state-default fc-corner-left fc-corner-right">
<span class="fc-button-inner">
<span class="fc-button-content save_button">Share</span>
<span class="fc-button-effect">
<span></span>
</span>
</span>
</span>
</form>
我用这个&LT;跨度&GT;
基础按钮样式的目的
I'm using this <span>
based button for style purposes.
我试图做的是在绑定一个click事件的&LT;跨度&GT;
按钮,触发一个提交功能,如:
What I'm trying to do is bind a click event on the <span>
button and fire a submit function, like:
$('.picture_js').click(function(e){
e.preventDefault();
pictureUpload();
return false;
});
function pictureUpload() {
var options = { url: 'chat/upload' }
$('#posts_form').ajaxForm(options);
}
但是,还有就是点击按钮(在控制台没有错误或者)没有反应 - 任何建议,就如何使这项工作
But there is no response to clicking on the button (no errors on console either) -- any suggestions how to make this work?
我想你可能需要包括并同时实现 beforeSubmit
和成功
选项进行文件上传的工作,因为在这个岗位建议:
jQuery的形式插件文件上传。
I think you may need to include and implement both beforeSubmit
and success
options for file upload to work, as suggested in this post:
Jquery form plugin file upload.
试试这个:
function pictureUpload() {
var options = {
url: 'chat/upload',
success: function() {},
beforeSubmit: function() {}
}
$('#posts_form').ajaxForm(options);
}