Quantcast
Channel: Question and Answer » json
Viewing all articles
Browse latest Browse all 148

How to print the output of the json?

$
0
0

I have this code :-

function retrieve_comments(){      
    $myPost = $_REQUEST['post_id'];
    $output = get_comments('post_id='.$myPost);      
    if(is_array($output)){         
        $response['output'] = $output;     
        foreach($response['output'] as $comment) :
            echo($comment->comment_author . '<br />' . $comment->comment_content);
        endforeach;
    }          
    else{         
        echo $output;          
    }          
    die;
}; 

This code return me in console this :

auther name <br /> comment of the post

Now , How can print it in single.php


Viewing all articles
Browse latest Browse all 148

Trending Articles