1

I'm current used Codeigniter and I want to create notification on menu In Controller

class Notes extends Frontend_controller{

    public function __construct() {
        parent::__construct();
    }
    public function index(){

        $this->data['data'] = array(
            'fuck'=>'fuck',
            'fucks'=>'fuckf',
            'fuckf'=>'fucks',
        );
        $this->load->view('templates/notification/notification',$this->data);
    }
}

Here is I echo data to view In View

    <li>
       <?PHP foreach($data as $data ){
        echo $data;
      } ?>
   </li>

finally I call in Jquery ajax

<script>
    $(function() {
        var data = document.getElementsByTagName("li").val();
        $.ajax({
            type: "POST",
            url: "<?PHP echo base_url("/notes/notes") ?>",
            data: data,
            contentType: 'application/json; charset=utf-8',
            dataType: 'html',
            async: true,
            cache: false,
            success: function(res) {
                $("#notes").html(res);
            }
        });
        return false;
    });
</script>

Result I got an errors as below

How can I do now Please help Uncaught ReferenceError: $ is not defined

1 Answer 1

1

You probably have not included JQuery in your code

Sign up to request clarification or add additional context in comments.

1 Comment

Oh you are right because I put jquery library below of Ajax calling thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.