extjac 0 Newbie Poster

Hello,

I am trying to populate the state drop-down based on the country selection. I creates this jQuery scrip that WORKS in firefox, chrome and mobile but for some reason does not work in IE8 (dont have IE7 or IE9 to test).
What am i missing?

    //update states/province drwon down
    $( "#country" ).change(function() 
    {
        var id = $(this).val();
        var request = $.ajax({ 
           type     : "GET",
           dataType : "json",
           url      : "/api/v1/country/"+id+"/states",
           cache    : true,

          beforeSend : function ()  
                      {
                        $("#state").html('<select name="state" id="state" class="form-control input-sm " required ><option value="">Loading...</option></select>').show();                        
                      }                            
        });
        request.done(function( response ) 
        {
              cuntries = '<select name="state" id="state" class="form-control input-sm " required >';
              $.each(response.data, function(i,data) {
                 cuntries +='<option value="'+data.code+'">'+data.name+'</option>';
              });
              cuntries += '</select>';

              $("#state").html(cuntries);

        });
        request.fail(function( jqXHR, textStatus ) 
        {
            alert( "Request failed: " + textStatus );
        });
        return false;     
    });//close change
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.