JSON parse error
-
I’m trying to use your plugin, but the front-end stuff won’t work due to a JSON parsing error.
On line 109 of
assets/js/frontend.jsyou have the following:var useCustomStarImages = jQuery.parseJSON(mr_frontend_data.use_custom_star_images);The
mr_frontend_data.use_custom_star_imagesis an empty string, and it throws a very useless errorUnexpected end of input.The reason it gets an empty string is because on line 437 of
multi-rating.php, you’re getting the setting with'use_custom_star_images' => $style_settings[Multi_Rating::USE_CUSTOM_STAR_IMAGES]If you switch it to
'use_custom_star_images' => $style_settings[Multi_Rating::USE_CUSTOM_STAR_IMAGES] ? 'true' : 'false'so that it actually outputs ‘true’ or ‘false’, then the JSON parsing stuff won’t break.
The topic ‘JSON parse error’ is closed to new replies.