Здравствуйте уважаемые участники форума! В jquery я новичек, но есть ТЗ связанное с ним. Прошу объяснить что написано!
function loadSourceData()
{
$.get("application/load_source_data.php", function(data, status){
//alert("status = " + status + "\ndata = " + data);
var server_data = jQuery.parseJSON(data);
for (var name in server_data) {
source_data[name] = server_data[name];
}
var energysource_not_gas = (typeof source_data.energysource == 'undefined' || source_data.energysource != 'gas');
var expectations_undefined = (typeof source_data.expectations == 'undefined');
if (energysource_not_gas || expectations_undefined) {
$step1.find("#expectations").hide().removeClass("radio");
}
$stage.find(".question.select").each(function(){
var name = $(this).attr("id");
//alert(name + " = " + source_data[name]);
if (typeof source_data[name] !== 'undefined') {
$(this).find("select").val(source_data[name]);
}
});
$stage.find(".question.radio").each(function(){
var name = $(this).attr("id");
//alert(name + " = " + source_data[name]);
if (typeof source_data[name] !== 'undefined') {
$(this).find('input[value="' + source_data[name] + '"]').prop("checked", true);
$(this).find('input[value="' + source_data[name] + '"]+span').addClass("checked");
}
});
});
}