Ajax Upload image

后端 未结 4 1057
失恋的感觉
失恋的感觉 2020-11-22 03:57

Q.1 I would like to convert this form to ajax but it seems like my ajax code lacks something. On submit doesn\'t do anything at all.

Q2. I also want the function to

4条回答
  •  鱼传尺愫
    2020-11-22 04:12

    You can use jquery.form.js plugin to upload image via ajax to the server.

    http://malsup.com/jquery/form/

    Here is the sample jQuery ajax image upload script

    (function() {
    $('form').ajaxForm({
        beforeSubmit: function() {  
            //do validation here
    
    
        },
    
        beforeSend:function(){
           $('#loader').show();
           $('#image_upload').hide();
        },
        success: function(msg) {
    
            ///on success do some here
        }
    }); })();  
    

    If you have any doubt, please refer following ajax image upload tutorial here

    http://www.smarttutorials.net/ajax-image-upload-using-jquery-php-mysql/

提交回复
热议问题