user6230357
user6230357

Reputation:

Load Ajax on clicking button

i have following :

   <button id="not" class="notification btn btn-default dropdown-toggle" data-toggle="dropdown" type="button">
<i class="fa fa-bell"></i>   


  <span class="badge badge-success" style="background-color:#f3b760">
10  </span>               




</button>  

<div id="show"></div>

I want div id "show" to load job-notification.php on clicking the button above, so i got this:

<script>
$(document).ready(function(){
    $("#not").click(function(){
        $("#show").load("job-notification.php");
    });
});
</script>  

FYI, Button is a DROPDOWN & job-notification.php contains results like this:

  <ul class="dropdown-menu dropdown-menu-right">
          <li>
    EXAMPLE 1
    </li>

     <li>
    EXAMPLE 2

    </li>

    </ul>

Why is this not working?

Upvotes: 2

Views: 919

Answers (2)

Aparna
Aparna

Reputation: 255

For loading css, you can use this: $('head').append('');

Add the following in append function in less than and greater than brackets : link rel="stylesheet" href="cssname.css" type="text/css"

Upvotes: 0

Aparna
Aparna

Reputation: 255

You can also try this one:
$(document).on("click","#not",function() {});

Upvotes: 1

Related Questions