Response after posting using jquery.form is not added to target div

295 Views Asked by At

I am using jQuery Form to post data. I am sending some response from the server that I want present in the div specified with the target option. I can see in firebug that the response is actually returned to the browser but the information is not turning up in the specified div.

I'm also using jQuery Multifiles in order to be able to upload more than one file. This part works fine and I can upload several files and those are presented on the server.

This is my own smicadminjavascripts.js

$(document).ready(function() {
     $('#newticketform').bind('submit', function(e) {                        
            e.preventDefault(); // <-- important
            $(this).ajaxSubmit({
                target: '#output'
            });
     });
});

my .html:

<html>   
  <head>

    <script language='javascript' type='text/javascript' src='jquery-1.7.1.min.js'></script>
    <script language='javascript' type='text/javascript' src='jquery.MultiFile.js'></script>
    <script language='javascript' type='text/javascript' src='jquery.form.js'></script>
    <script language='javascript' type='text/javascript' src='smicadminjavascripts.js'></script> 
 <head>
 <body>

    <form id='newticketform' enctype='multipart/form-data'method='POST'>
    <input type='hidden' name='MAX_FILE_SIZE' value='1000000' />
    <label for='title'>Rubrik</label> <input type='text' id='title' name='title'/><br/><br/>
             <label for='description'>Beskrivning</label> <textarea rows='15' cols='50' id='description' name='description'></textarea><br/> 


                <!-- The file element -- NOTE: it has an ID -->
             <input class='multi' id='my_file_element' type='file' name='file[]' maxlength='5' >

             <div id='files_list'></div>
             <input type='submit' name='upload' value='Upload' /> 
    </form>
     <div id='output'></div>
  </body>
</html>

What is my problem and how do I fix it?

Thanks!

1

There are 1 best solutions below

2
On

I downloaded the jquery.form again (http://malsup.github.com/jquery.form.js) and replaced the it.

Still it didn't work. The problem was that the file wasn't downloaded to the development server again (using NetBeans/ftp). I had to check the box again in order to get it downloaded.

Now it works. Don't really know what the actuall problem was.