0

I have the following setting for my easyautocompelete input box:

var optionsCCGSavingsAutocomplete = {
        url : "/api/sitecore/SirduplaCoUkCalculator/AutoCompleteCCGSavings",                
        getValue: function(element) {
            // return element.Text;
             console.log(element);
        },
        maxNumberOfElements: 20,
        match: {
            enabled: true
        },
        highlightPhrase: false,
        theme: "square",
        ajaxSettings: {
            method : "POST",
            contentType : "application/json; charset=utf-8",     
            dataType : 'text',
            data : JSON.stringify({'Text':$('#CCGModel_Text').val()}),
            success: function(data) {
                return JSON.parse(data);
            }         
        },
        requestDelay: 400        
    };

I initialize it like so:

$("#CalculatorCCG #CCGModel_Text").easyAutocomplete(optionsCCGSavingsAutocomplete); 

The problem is the data i get from the server i need to JSON.parse() the data before it can be used by easyAutocomplete, how do i JSON.parse the data before the getValue() function runs ?

Alexander Solonik
  • 9,838
  • 18
  • 76
  • 174

0 Answers0