> > <script type="text/javascript"> > $(document).ready(function() { > > $('#form1').ajaxForm({ > target: '#message', success: function(){$ > ('#message').fadeIn('slow');} > }); > }); > </script> >
> <div id="message"> > <?php echo $msg; ?> > </div> > </body> > </html> > > The problem is, every time I add a new record the message div fills up > with a new line "1 record added." and if I check the source code, > inside "message' there is another "message" created. So if I add 10 > records, original "message" div fills up with 10 more same div and > therefore 10 lines of "1 record added.". Eventually the file size > increases. How do I solve this problem? I'm new to JQuery. Please help! > 'target' identifies the element to which the server response will be set as the HTML. It is not an element that is replaced itself, it is an element whose content is replaced. In your case you keep returning a new message div, and so they keep nesting. Try starting with an empty #message div in your markup and then have the server return just the message text when the form is submitted. Mike