Reputation: 401
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
Upvotes: 1
Views: 274