Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function comments(id,postId,user_id) {
- var user_comments = encodeURIComponent($("#commentsId_"+id).val());
- if(user_comments!=''){
- var img = $("#img_"+id).val();
- var username = "<?php echo $this->session->userdata('username'); ?>"
- $.ajax({
- type: "POST",
- url: "<?php echo base_url() ?>social/userscomment/" +user_id+"/"+postId+"/"+user_comments,
- data:{ user_comments : user_comments},
- success: function(data) {
- $("#commentsId_"+id).val('');
- var $sparkLines = $('.comments_body_'+id);
- $("#comments_add_"+id).append('<div id="id' + ($sparkLines.length + 1) + '" class="comments_body_"'+id+'><div class="feed-element comments_body_"'+id+'><a class="pull-left"><strong>'+username+' <i class="fa fa-comment-o"></i></strong></a><div class="media-body">'+user_comments+'<br></div><div class="col-lg-12"><a id="span_'+postId+'" onclick="callajaxcommcool('+postId+')" class="btn btn-xs btn-white"><i class="fa fa-star"></i><span id="span1_'+postId+'" style="display:none;">1</span> Cool </a></div></div></div></div>');
- }
- });
- }
- }
- public function userscomment($comment_id,$post_id,$user_comments){
- $this->load->model('comments');
- $user_comments = utf8_decode(trim(mysql_real_escape_string($user_comments)));
- if(!empty($user_comments)){
- $data = array("user_id" => $this->session->userdata('user_id'),
- "comment_user_id" => $comment_id,
- "comments" => $user_comments,
- "post_id" => $post_id,
- "username" => $this->session->userdata('username')
- );
- $this->comments->insertComments($data);
- //logged user
- $userRow = $this->register->get_login($this->session->userdata('user_id'));
- redirect('social/userprofile/'.$userRow[0]['username']);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement