Answer the question
In order to leave comments, you need to log in
Why is data not being passed to getJSON (JQuery) whose source is var_dump?
Good evening.
To begin with, I created a function where I get a list of records of 1C-Bitrix Highload blocks:
public static function getMakes()
{
$entity_data_class = GetEntityDataClass(4);
$rsData = $entity_data_class::getList(array(
'select' => array('ID', 'UF_NAME')
));
while($el = $rsData->fetch()){
var_dump($el);
}
}
echo json_encode( Akb::getMakes());
$.getJSON("api.php", {
action: "getAkbMakes"
})
.done(function(data) {
var options = '<option value="" selected></option>';
$.each(data, function(i, item) {
options += '<option value="' + item.ID + '">' + item.UF_NAME + '</option>';
$('#make').html(options);
});
alert("Test");
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question