I've been working on converting my CF-based admin functionality to just
what you describe, except doing it with Thickbox instead of SimpleModal.

Except for how the modal windows may be handled, I don't think there would
be any difference between what I do and what you asking about.

Here's an example of the jQuery I use to submit my forms and then handle
the data that's returned.  This ajax function is used in creating site
manager
records, including permissions, for a website.

Let me know what questions you have about this.  I handle the success
portion
of the first ajax section a little differently with an include in a
subsequent ajax
function in order to get the CF processing to fire.

Rick


<script>

$(document).ready(function() {

     $('#previewButtonID').click(function(){

          var values = {    dsn:                     '<cfoutput>#application
.dsn#</cfoutput>',
                                 firstName:            $('#firstNameID').val
(),
                                 lastName:            $('#lastNameID').val
(),
                                 emailAddress:      $('#emailAddressID').val
(),
                                 password:            $('#passwordID').val
(),
                                 deals:                  $(
'input[name=deals]:checked').val(),
                                 emailNewsletter:   $(
'input[name=emailNewsletter]:checked').val(),
                                 siteManagers:       $(
'input[name=siteManagers]:checked').val()         };

           $.ajax     ({       cache:                 false,
                                 type:                   "post",
                                 url:
"../components/siteManagerProcessor.cfc?method=mPreviewSiteManager&returnformat=json"
,
                                 dataType:            "json",
                                 data:                   values,
                                 success:             function(response){

                                                              if      (
response.MESSAGE == "Success"      )
                                                                     {
$('#siteManagerWrapperDivID').hide();

$('#previewButtonID').hide();


$.ajax     ({     url:
'../includes/include_previewSiteManagerDivContents.cfm',

cache:      false,

success:   function(html) {


$('#previewSiteManagerDivID').prepend(html);


}

});


$('#previewSiteManagerDivID').fadeIn(500); }

                                                              else
{    $('#unsuccessful').empty().fadeIn(500).append(response.MESSAGE)    };

                                                        }
          });

     });

});

</script>




On Mon, Jun 29, 2009 at 2:45 PM, Erich93063 <erich93...@gmail.com> wrote:

>
> I am creating an admin in ColdFusion and am trying to add a feature
> where when the user clicks the "edit" button for something, a modal
> window will pop up which contains a form (loaded from an external
> file) that when the user submits it, it's an AJAX submit and then the
> modal window closes and fires off a function that updates the display
> page. I am using SimpleModal
>
> http://www.ericmmartin.com/simplemodal/
>
> and I managed to load an external form file into the modal window
> using $.get but then I can't figure out how to get that form that
> loads in the modal window to submit via AJAX instead of the default
> form post that happens. I need to submit their data via AJAX and then
> if successful, close the window and do the update function on the
> display. Has anyone already done this?
>
>


-- 
--------------------------------------------------------------------------------------------------------------------------------------------------
"Ninety percent of the politicians give the other ten percent a bad
reputation."  Henry Kissinger

Reply via email to