-1

We have 2 identical servers running windows, sql server and coldfusion 11 standard

We have migrated a website to one of the servers but when we copy the site to the second server no AJAX calls work! Everything else works ok just the ajax calls. The only difference between the 2 coldfusion installations is that one is a develpoment server and the other has been configured as a production server.

Why are ajax call not working on the production server?

EXAMPLE - As mentioned the 2 servers have the exact same website files and the exact same database. The development site works but no ajax calls work on the production server.

<script type="text/javascript">
            $(function(){               
                var Location = $("#Location"),
                Other = $("#Other"),
                ContactNo = $("#ContactNo"),
                allFields = $( [] ).add( Location ).add( Other ).add( ContactNo );

            var txtLocation = $('#Location').val();
            var txtOther = $('#Other').val();            
            if(txtLocation == 'Other' || txtLocation == 'Client site'){   
              $('#Other').show();  
            }   
            else{   
              $('#Other').hide();   
            }  

            $('#Location').change( function() {
                var selected = $(this).val();   
                if(selected == 'Other' || selected == 'Client site'){   
                  $('#Other').show();   
                }   
                else{   
                  $('#Other').hide();   
                }  
            }); 

            $('#dialog-MyStatus').dialog({  
                 autoOpen: false,  
                 width: 400,  
                 modal: true,  
                 resizable: false,  
                 buttons: {
                    "Update my status": function() {
                        var bValid = true;
                        allFields.removeClass( "ui-state-error" );       
                        bValid = bValid && checkLength( Location, "ContactNo", 2, 50 );
                        if ($('#Location').val() == 'Other'  || $('#Location').val() == 'Client site'){
                            bValid = bValid && checkLength( Other, "Other", 3, 50 );
                        }

                        if ( bValid ) {
                            //organize the data properly
                            var data = 'method=SetStatus&Location=' + Location.val() + '&Other=' + Other.val() + '&ContactNo=' + 
                            ContactNo.val();                    
                            //start the ajax
                            $.ajax({
                                url: "/templates/cfc/mystatus.cfc", 
                                type: "POST",
                                data: data, 
                                cache: false,
                                success: function (html) {          
                                    //hide the form
                                    $('#MyStatus').fadeOut('slow');
                                    var txtLocation = $('#Location option:selected').text();
                                    var txtOther = $('#Other').val();
                                    var txtContactNo = $('#ContactNo').val();                                       
                                    $('#MyLocation').text(txtLocation);
                                    if (txtLocation != 'Other' && txtLocation != 'Client site'){
                                        $('#MyLocationOther').text('');
                                        $('#MyRemLocation').text(txtLocation);
                                    }
                                    else {
                                        $('#MyLocationOther').text(txtOther);
                                        $('#MyRemLocation').text(txtOther);
                                    }
                                    $('#MyRemContactNo').text(txtContactNo);                                            
                                    $('#MyContactNo').text(txtContactNo);                                           
                                    $('#StatusMessage').text('');   
                                    location.reload();                                      
                                    $('#dialog-MyStatus').dialog("close");  
                                }   
                            });
                        }
                        //cancel the submit button default behaviours
                        return false;
                    }//,
                    //Cancel: function() {
                    //  $(this).dialog("close");
                    //}
                },
                close: function() {
                    allFields.val("").removeClass( "ui-state-error" );
                }                    
             });                 
        });
        function MyStatusSet (){
            $('#MyStatus').fadeIn('slow');
            var txtCurrentLocation = $('#MyLocation').text();
            var txtCurrentLocationOther = $('#MyLocationOther').text();
            var txtCurrentContactNo = $('#MyContactNo').text();
            $("#Location option[value='"+txtCurrentLocation+"']").attr('selected', 'selected');
            $('#Other').val(txtCurrentLocationOther);
            $('#ContactNo').val(txtCurrentContactNo);
            $('#dialog-MyStatus').dialog('open');   
            return false; 
         };
        </script>
Marios
  • 101
  • 1
  • 1
  • 5
  • Can you post an example of one of the AJAX calls that does not work? – nurdyguy Jul 30 '15 at 19:02
  • Welcome to Stack Overflow. Just for future reference, in addition to including a *small* sample of code that reproduces the issue, please be sure to include any error messages with the initial question. Just saying "no ajax calls work" is very ambiguous. Though you were eventually able to figure out the problem (kudos), including information like "this call returns a 404 error" is an important detail others can use to help diagnose the issue more quickly :) – Leigh Aug 04 '15 at 02:19

2 Answers2

1

Thank you all for your time with this issue. We found out what it was. When we migrated the development version to the production site we didn't create the virtual directory "jakarta" that points to the necessary dlls. Once we created this virtual directory everything worked ok. I think this is a requirement from ColdFusion version 10. See ColdFusion 10, IIS 7.5 - Getting a 404 even though file exists.

Community
  • 1
  • 1
Mario
  • 11
  • 1
0

Log into the CF Administrator and go to Debugging & Logging > Debug Output Settings and make sure you have enabled the Enable AJAX Debug Log Window option.

Community
  • 1
  • 1
user3440782
  • 144
  • 1
  • 14