i have an error in JSON.parse(), i have .php file which contain method to retrieve data from database and .js file for autoComplete function, my .php file return data as str
The error is within your server side, when there's an error on your server side, the response comes with html tags '<' when there's an error php will add tag with the error message. Therefore your json contains the html tags and becomes invalid because of unexpected tags.
The error is within this array
$eventstArray[] = array
(
'label' => $eventsQuery2['eventTitle'];
'venue' => $eventsQuery2['venueName'];
'category' => $eventsQuery2['catDesc'];
'price' => $eventsQuery2['eventPrice'];
'description' => $eventsQuery2['eventDescription'];
);
it should be
$eventstArray[] = array(
'label' => $eventsQuery2['eventTitle'],
'venue' => $eventsQuery2['venueName'],
'category' => $eventsQuery2['catDesc'],
'price' => $eventsQuery2['eventPrice'],
'description' => $eventsQuery2['eventDescription']
);
(The problem source was the semi-colon(;) after the description value. It should be only at the end of array)