Maybe there is something screwy with Coldfusion’s Ajax functions, but I cant figure this one out… Im just trying to post some data using ColdFusion.Ajax.submitForm, then load new content into #CartPopup using ColdFusion.navigate. I need Details.cfm to finish processing the form data before I load the Div.
function add2Cart(prodid){
var submit = ColdFusion.Ajax.submitForm('AddToCart', 'Details.cfm');
setTimeout("navigate(prodid)", 2000);
}
function navigate(prodid){
ColdFusion.navigate('divbind.cfm?PRODID='+ prodid,'CartPopup','CB','EH');
return false;
}
Do perhaps a delay isn’t the best way. I thought of using:
jQuery.when
but I’m wondering if maybe my issue if with the CF ajax functions… I’m super grateful for any insight or alternative approaches.
Thanks!
Your first snippet of code should be:
As you can see here
submitFormcan receive 2 callback handlers, one when the submit is done and one for error handling.