(My apologies to everyone on the list...when I started this thread,
I didn't know if this would be more of a CF or jQuery issue...turns
out, at least for now, it looks like the solution is client-side)

It looks like the code falls within that pattern...

Here's what I'm using:

$.ajax  ({  cache:        false,
            type:         'post',
            url:
'rentalProperties.cfc?method=mAddRentalProperty&returnFormat=json',
            dataType:     'json',
            data:         values,
            async:        false,
            success:      function(response) {

                             if   (   response.STATUS == 'Success'   )
                                  {   var rentalPropertyAddDialogHTML =
'rentalPropertyAddDialogHTML.cfm?' + new Date().getTime();           
 
$('.rentalPropertyAddDialog').fadeOut(100);
                                      $('.rentalPropertyAddDialog').empty();
 
$('.rentalPropertyAddResponseDialog').fadeIn(100);
                                      fnGetRentalProperties();       }

                             else {   alert('Failed to add new property');
}

                          }

etc...

What may be complicating this is the fact that since images can't be
submitted via true AJAX, then an iframe has to be used to intercept the
submission and handle it.  That's modified code that Ben Nadel wrote
for this purpose...I'm not totally clear on how it interacts with
the $.ajax call.

Here's the code that reacts when the form is submitted.

$(document).ready(function() {

   $('#addButton').live('click', function() {

      $('.rentalPropertyAddDialog').hide();
      processAddRentalPropertyForm();
   });
});

function processAddRentalPropertyForm() {

   var addNewRentalPropertyForm = $('#addNewRentalPropertyForm');
   addNewRentalPropertyForm.submit(function(objEvent){

      var jThis   = $(this);
      var strName =  ("uploader" + (new Date()).getTime());
      var jFrame  = $("<iframe name=\"" + strName + "\" src="about:blank\"
/>" );

      jFrame.css("display", "none");
      jFrame.load(function(objEvent){

         var objUploadBody =
window.frames[strName].document.getElementsByTagName("body")[0];
         var jBody = $(objUploadbody);

      });

      $("body:first").append(jFrame);

      jThis   .attr("action",
"rentalProperties.cfc?method=mAddRentalProperty&returnFormat=json")
              .attr("method", "post")
              .attr("enctype", "multipart/form-data")
              .attr("encoding", "multipart/form-data")
              .attr("target", strName);

      var dialogPosition = $(window).scrollTop();
      var dialogPosition = dialogPosition + 100;
      $('.rentalPropertyAddResponseDialog').css('top', dialogPosition);
      $('.rentalPropertyAddResponseDialog').fadeIn(250);

   });
}






-----Original Message-----
From: James Holmes [mailto:james.hol...@gmail.com] 
Sent: Wednesday, September 23, 2009 12:06 AM
To: cf-talk
Subject: Re: CF & jQuery - How to delay ajax completion until images are
processed...


async: false should be doing the job.

To be sure, your code looks something like that example:

jQuery.ajax({
         url:    'http://example.com/catalog/create/'
                  + targetNode.id
                  + '?name='
                  + encode(to.inp[0].value),
         success: function(result) {
                      if(result.isOk == false)
                          alert(result.message);
                  },
         async:   false
    });

right?





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:326532
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to