简体   繁体   中英

Suggestion for FB meta tags using jquery and php

here is my problem:

i have FB app, where i am getting data from json and using that data for making list of items in my main window, i can click on every item, and after i click it opens in new ajax window where i get more info about that item

problem is about meta tags for FB, cos i have LIKE button for every item, so when i click on it, i can post that item on FB wall with infomations like title, picture and description

i have this situation: when i click on item in my main window, it opens in new ajax window, and i manually add item it to the URL like this:

window.location.href=window.location.href + "?id=" + ID + "#id=" + ID;

and php code is this:

    <?php

    if(isset($_GET['id'])){

    $json = file_get_contents("http:....." . $_GET['id'] . "&...");
    $json_array = json_decode($json);
    print '<meta property="og:title"       content="' . $json_array->title . '" /> ';
    }
?>

it all work all right, but i get problem with refreshing page, cos every time i click on item in my main window it open new window cos i add GET parameter in url

so how can i avoid refreshing page and still have functionality for describe like option on FB wall

If you have a like button for every item in a list, this means you also have a corresponding page for each item too, right? If so, cant you have he meta tags predefined on each lf those pages?

Facebooks likes are designed to like pages so other friends can click through and see the page that the users liked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM