[wd_asp elements=’search’ ratio=’100%’ id=1]

Dynamically load dropdown placeholder ckeditor

24th May 2017

Jquery - Tricks

jquery icon

Add a variable in config.js and populated with values from an ajax call,
add to top of page.

var place = '';
$.ajax({
url: 'getvalues.php',
async: false,
dataType: 'json',
success: function(data) {
place = data;
}
});

The ajax call returns the values as JSON. (echo json_encode($my_array))

Then I assigned the variable to the placeholders inside the code of the ckedit config part

config.placeholder_select = {
placeholders: place,
format: '{%placeholder%}'
};

Hope that helps 🙂
Thanks to Sigal Goplaiah