SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jan 2009
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jquery .submit() only works once

    I'm making a multi-file uploader with progress bar using jquery. Everything works fine once, but none of my javascript functions fire when the file uploader is submitted after this. The file uploads to an invisible iFrame so that the page doesn't refresh. Do I need to reset something so that the submit will work a second (and more) time?

    Here is the the javascript:

    Code:
    $(document).ready(function() {
     	
    
    	try {
    		$("#file_uploader").submit(function(){
    			
    			
    			fileName = document.getElementById('upload').value;
    			$("#debugText").html(fileName);
    			if(fileName!=""){
    				$("#progress_div").slideToggle("slow",function() {
    					
    					$("#debugText").html("slide down")
    				});
    				beginCall();
    			}
    			
    		})
    		
    	}catch(e){
    		alert(e);
    	}
    
    
    
    		
    		
    
    
     }); //end document ready

  2. #2
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    Ireland
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What is the action of the form in the iframe? Does it reload the page?

  3. #3
    SitePoint Member
    Join Date
    Jan 2009
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The form action is the page url, but the target is the Iframe. Is this the problem?
    What should the sction be for a form like this?

  4. #4
    SitePoint Member
    Join Date
    Jan 2009
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I checked out the iframe contents and, when submitted, the form has sent the whole page there, including the header, which I suspect means that all my javascript is there too. Is this likely to be causing the conflict?

    Is there a way to avoid this?


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
  •