Pass Editor field name to function

Pass Editor field name to function

peterbrownepeterbrowne Posts: 294Questions: 50Answers: 0
edited August 26 in Editor

I have a $.getJSON function used to populate a select list:

        var unit_groups = [];   
              
        $.getJSON("program_data/get_unit_groups.php", function(data) {
            var option = {};
            $.each(data, function(i,e) {
                option.label = e.text;
                option.value = e.id;
                unit_groups.push(option);
                option = {};
            });
        }).done(function(){editor.field('unit_group.unit_group_pk').update(unit_groups);
                          });

I now want to pass the value of an Editor field to that function. The field name is program_outcome.program_outcome

How would I do that?

Answers

  • rf1234rf1234 Posts: 2,444Questions: 78Answers: 353
    edited August 26

    editor.val('program_outcome.program_outcome')

    Looks like Editor is a global variable in your code anyway. So no need to pass the field value.

Sign In or Register to comment.