Reputation: 15
I have a shout box on my Joomla site that is producing this error.
This is the Error:
[Error] TypeError: 'undefined' is not an object (evaluating 'config['show_photos']')
And javascript code is:
function prepareShout(json, config, permissions, data)
{
html = '<div class="shoutbox-row" id="shout-' + json['s_id'] + '">';
html += '<div class="shoutbox-member">';
if (config['show_photos'])
{
if (json['s_mid'] != 0)
{
if (config['profiles'])
{
html += '<a class="shoutbox-avatar" href="' + json['s_avatar']['link'] + '" title="' + data['ptitle'] + '"><img src="' + json['s_avatar']['image'] + '"></a>';
}
else
{
html += '<span class="shoutbox-avatar"><img src="' + json['s_avatar']['image'] + '"></span>';
}
}
else
{
html += '<span class="shoutbox-avatar"><img src="' + json['s_avatar']['image'] + '"></span>';
}
}
Is it possible to fix this issue?
Upvotes: 0
Views: 1251
Reputation: 20024
just confirm your config
object has a value as well like this
if (config && config['show_photos'])
...
if (config && config['profiles']){
...
Upvotes: 1