I have this function for an ajax edit form. <script type="text/javascript"> $(document).ready( function() { var form_id = '#<?php echo $form_id ?>'; $(form_id).bind('submit',function() { var form_url = $(form_id).attr('action'); var page_target = form_url.substr(1).replace( new RegExp( "/" ,"g"), "_" ); var update_target = (page_target.replace("_edit", "")); var queryString = $(form_id).formSerialize(); $(this).ajaxSubmit({ type: 'post', url: form_url, data: queryString, target: '#' + update_target, success: function(response, status) { // Response was a success if (response.success === true) { $('#' + update_target).slideToggle('slow'); $('#' + page_target).html(response).slideToggle('slow'); // Response contains errors } else { $('#'+update_target).html(response); } } }); return false; }); }); </script> So if the form if saved will update the content (update_target ) and hide the form (page_target ) after save or if not saved will simply return the form with errors needing correction. The functionality of the save / not saved works but the success in the ajaxSubmit is getting lost. The $('#' + update_target).slideToggle('slow'); $('#' + page_target).html(response).slideToggle('slow'); or $('#'+update_target).html(response); does nothing. No slide no nothing...just sits there
I tried alert(response); for both success and fail of the save and the html data shows up so u until that point everything is working. Just my var page_target and var update_target seem to vanish in the success. Any ideas where I went wrong or how to fix this? Thanks Dave