Skip to main content
Hi, I folllowed the trailhead (Build a restaurant locator Lightning Component )  Leveraging the Contact Record Data and it also marks as completed. but when i try to see the output, I get the following error,

Unfortunately, there was a problem. Please try again. If the problem continues, get in touch with your administrator with the error ID shown here and any other related details. Something has gone wrong. Error in $A.getCallback() [SyntaxError: Unexpected end of JSON input] Failing descriptor: {markup://c:InTheArea}. Please try again.

Can anyone help me to undersatnd why am I getting this error.

Thank you
7 answers
  1. Oct 5, 2016, 12:48 PM
    Here are my client side controller and helper:

    HELPER***********************

    ({

        getLocalList : function(component) {

            //var searchTerm = component.get("v.defaultSearch");

            var recId = component.get("v.recordId");

            var location  = component.get("v.location");

            //var action = component.get("c.getLocal");

            var searchTerm = component.find("searchTerm").get("v.value");

            if(searchTerm == null){

                searchTerm = component.get("v.defaultSearch");

            }

            location = JSON.parse(location);

            var action = component.get("c.getListByAddress");

            action.setParams({

                "recordId" : recId,

                "searchQuery" : searchTerm

            });

            action.setCallback(this, function(response){

                this.doLayout(response, component);

            });

            $A.enqueueAction(action);

                              

        },

        doLayout: function(response, component){

            var data = JSON.parse(response.getReturnValue());

            component.set("v.restaurantList", data.bizArray);

            console.log("The data: ", data);

        }

    })

    CONTROLLER(Client side)***********************************

    ({

        doInit : function(component, event, helper) {

            helper.getLocalList(component);

        },

        updateSearch : function(component, event, helper){

            helper.getLocalList(component);

        }

    })

     
0/9000