-4
    <script language="JavaScript" type="text/javascript" >
    $(document).ready(setInterval(function(){
        $("#appointment").html(
            " <a class="dropdown-toggle" data-toggle="dropdown" href=""><i class="fa fa-bell fa-fw"></i><span class="badge"><?php echo htmlentities($noti_count); ?></span> <i class="fa fa-caret-down"></i>
            </a>"
        );
    }), 1000);
</script>

I get error " Uncaught SyntaxError: missing ) after argument list " in console i couldn't understand why !please help me.

Sathiyakugan
  • 674
  • 7
  • 20
  • 1
    You can't use double quotes in a double quoted string. Use single quotes for the class names and it should work fine – Erick T. Jul 03 '17 at 04:01

1 Answers1

1

Too many mistakes

  1. $(document).ready() expects function as an argument.
  2. setIterval started and closed. but $(document).ready method is not closed.
  3. String formation for HTML is wrong. enclose ' single quote inside double or vice versa.

Try this. and instead of 10 use your PHP code.

$(document).ready(function() {
  setInterval(function() {
    $("#appointment").html('<a class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="#"><i class="fa fa-bell fa-fw"></i><span class="badge">10</span> <i class="fa fa-caret-down"></i></a>');
  }, 1000);
});
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="appointment"></div>
Priya
  • 1,522
  • 1
  • 14
  • 31