Jquery to populate drop downs

Jquery to populate drop downs

Hi
I'm trying to populate some combo boxes from a database. I'm using PHP and Jquery but am managing to crash IE8 with the following error:

Faulting application name: iexplore.exe, version: 8.0.7600.16385, time stamp: 0x4a5bc69e
Faulting module name: mshtml.dll, version: 8.0.7600.16419, time stamp: 0x4aa1d5b9
Exception code: 0xc0000005
Fault offset: 0x0007a82c
Faulting process id: 0x2c4
Faulting application start time: 0x01ca5bd2bb86a4ff
Faulting application path: C:\Program Files (x86)\Internet Explorer\iexplore.exe
Faulting module path: C:\Windows\SysWOW64\mshtml.dll
Report Id: 43f3ef58-c7c8-11de-8040-00235a29f7e5


The code works fine in IE8 Compat mode but in Firefox displays the replced text outside the table !

This is my Jquery code:

<!-- JQuery script for populating dynamic combo boxes -->
<script type="text/javascript" src="../../includes/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
   $(document).ready(function(){
        $("#selectionresult").hide();      
         $("#idOldInjury").change( function() {
         $("#selectionresult").hide();
         $("#result").html("");         
         $.ajax({   
         type: "POST",
         data: "data=" + $("#idOldInjury").val(),
         url: "select_addmedicalinjury.php",
            success: function(msg){
            if (msg != ''){     
               $("#selectionresult").html(msg).show();
               $("#result").html("");
            }
            else{               
               $("#result").html('<em>No item result</em>');
            }           
            }     
         });
      });
   });
</script>


#selectionresult and #result are <p> tags with the correct ids and the php page returns populated select lists.

The code works perfectly the first time round but crashes on the second change to #idOldInjury

Any help or pointers appreciated - this is my first play with JQuery so be gentle with me ;-)

Cheers

Steve[/code]
    • Topic Participants

    • steve