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