SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Patience... bronze trophy solidcodes's Avatar
    Join Date
    Jul 2006
    Location
    Philippines
    Posts
    911
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Submit form after successful AJAX file upload?

    Hi guys,

    I have codes below,
    Code:
    	$(document).ready(function() {
    		$('#imageform').ajaxForm( {
    		    dataType : 'json',
    		    beforeSubmit: function() {
    		        $(this).addClass('loading');
    		        $('#uploadBox').html('<div id="progressOverlay"><div class="progress progress-striped"><div class="bar" id="progressBar" style="width: 0%;">0%</div></div></div>');
    		    },
    		    uploadProgress: function ( event, position, total, percentComplete ) {
    		        if (percentComplete == 100) {
    		            $('#progressBar').css('width',percentComplete+'%').html('Okay!');
    		        } else {
    		            $('#progressBar').css('width',percentComplete+'%').html(percentComplete+'%');
    		        }
    		    },
    		    success : function ( json ) {
    		        //Your Custom JS Code Here
    		    }
    		});
    	});
    These codes is for AJAX file upload.
    What I wanted is after successful AJAX file upload, I wanted it to submit the form.
    What jQuery codes should I put on success:?


    Thank you very much in advanced.
    I Love coding...
    Don't click this link.

  2. #2
    SitePoint Mentor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,257
    Mentioned
    32 Post(s)
    Tagged
    5 Thread(s)
    Hi solidcodes,

    You're using the jQuery Form plugin, right? If so, it looks like your form should be submitted by AJAX by the plugin, so what you put in the success callback depends on what you want to happen after the form has been submitted.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •