I have created the following javascript code. This code is working fine but dreamweaver say, line (function load_unseen_notification(view = '')
) something wrong. But what is the problem here code is working fine. I think the problem will come view =''
. How can i fix it?
function load_unseen_notification(view = '')
{
$.ajax({
url:"fetch.php",
method:"POST",
data:{view:view},
dataType:"json",
success:function(data)
{
$('.dropdown-menu').html(data.notification);
if(data.unseen_notification > 0)
{
$('.count').html(data.unseen_notification);
}
}
});
}
DreaemWeaver is not using ES6 (which introduced default values for parameters) by default. But you can set this behavior in the settings. Just take a look at it.
JavaScript before ES6 doesn't support default values for parameters. But you can rewrite it to if you don't wnat to change the settings (which would be recommend):
function load_unseen_notification(view) {
view = view || ''; // if view is defined, use the value. If not set view to an empty string.