this is my code :
$(function(){
$("div#SearchBox").ready(function(){
var selectsCount;
$.getJSON("http://localhost/cms/publicity/list/jsonoptions/", function(result){
selectsCount = (result.length);
})
alert(selectsCount);
})
})
the result is undefined , why ?!
or this code :
$(function(){
$("div#SearchBox").ready(function(){
$.getJSON("http://localhost/cms/publicity/list/jsonoptions/", function(result){
$.getJSON("http://localhost/cms/publicity/list/jsonoptitems/color/", function(secondResult){
var selectBoxes = '';
for (var i = 0; i < result.length; i++) {
selectBoxes += '<select id="'+result[i].OptionValue+'">';
selectBoxes += '<option value="'+result[i].OptionValue+'">'+result[i].OptionDisplay+'</option>';
selectBoxes += '</select>';
}
$("div#SearchBox").html(selectBoxes);
})
})
})
})
it's not working too ...
infact I wana to get selects from a json file , then get that select's options from another json file with getJSON function in Jquery
so I want to do it .
please help me , thank you a lot :x