function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vikash TiwaryVikash Tiwary 

URGENT: EasyAutocomplete do not work with remote data

EasyAutocomplete plugin works well as long as I pass the data directly but it do not work when we load the data via remote method. I am using this in visualforce page. Below is the error I get in console. Please help!!

WARNING: Fail to load response data.
<script>
    var options = {

          data: function(phrase) {
            var str = '[{"name": "Afghanistan", "code": "AF"}, {"name": "Aland Islands", "code": "AX"}]'; 
            var obj = JSON.parse(str);
            return obj ;
          },

          getValue: function(element) {
            return element.name;
          },

          ajaxSettings: {
            dataType: "json",
            method: "POST",
            data: {
              dataType: "json"
            }
          },

          preparePostData: function(data) {
            data.phrase = $("#inputId").val();
            return data;
          },

          requestDelay: 400
        };


    $("#inputId").easyAutocomplete(options);
</script>