What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 150 Stack Exchange communities.

From the flair page, it is mentioned that it is available in JSON format. How can I use its response for my website similar to the JSONP example? If it's not possible, why?

share|improve this question

1 Answer 1

Hm... you mean like server-side?

Here's some code in PHP that does the equivilant of the JSON example:

$flair_json_url = 'http://meta.stackoverflow.com/users/flair/100835.json';
$flair_data = json_decode(file_get_contents($flair_json_url));
<div id="so-flair">
    <div id="gravatar"><?php print $flair_data->gravatarHtml; ?></div>
    <div id="reputation"><?php print $flair_data->reputation; ?></div>
    <div id="badges"><?php print $flair_data->badges; ?></div>
    <div id="displayname"><?php print $flair_data->displayname; ?></div>
    <a id="profileurl" href="<?php htmlspecialchars($flair_data->profileUrl); ?>">Visit my profile</a>
share|improve this answer
Using JavaScript only if it's possible. If it's not possible using JavaScript only, why? – Randell Apr 28 '10 at 13:02
What part of the JSON example on the flair page are you having problems with? – heavyd Apr 28 '10 at 13:10
It's a JSONP example. I'm looking for an example for client-side processing of the JSON. – Randell Apr 28 '10 at 13:13
Thanks headvyd. That explains it. – Randell Apr 29 '10 at 0:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .