Graph API Returning All Status Results as Undefined -
i creating search bar queries facebook results. when type word search , click search, results posted "status"....i lot of undefined fields. says "'user' shared status", , under photo section says undefined, , there's no actual status. it's blank. how can fix this?
anything else fine...."'user shared photo" shows photos shared. there description...sometimes. shared link works too.
i want able type more 1 word in search bar, , able search again. of now, have refresh page in order search again.
i've checked other topics answer, topics aren't how i'm doing search. haven't found answer yet. can help! thanks....here's link page search bar is. i'll include code well. http://ericnaff.com/html5/p3/ also- how can make "enter/return" starts search well?
code-
function searchfb(usersearchparameter) {
$.getjson('https://graph.facebook.com/search?q=' + usersearchparameter + '&callback=?', function(fbresults){ $.each(fbresults.data, function() { // data templating $('<article class="fbresults"></article>').append ( '<section class="resultssource"><h6 class="shareheader">' + '<img class="fromuser" src="https://graph.facebook.com/' + this.from.id + '/picture" height="50" width="50" alt="' + this.from.name + '">' + '<a href="http://www.facebook.com/' + this.from.id + '" class="fromname">' + this.from.name +'</a> shared <a class="typelink" href="' + this.link + '">' + this. type + '</a> </h6>' + '<time class="createdtime" datetime="' + this.created_time + '">' + fuzzyfacebooktime(this.created_time.replace(/-/g,'/')) + ' ·</time>' + '<img class="typelinkicon" src="' + this.icon + '" alt="icon"></section>' + '<section class="resultsdescription"><h6><a class="sharelink" href="' + this.link + '">' + '<img class="sharepicture" src="' + this.picture + '" height="90" width="90" alt="' + this.name +'">' + '<span class="sharename">' + this.name + '</span>' + '<span class="sharecaption">' + this.caption + '</span>' + '<span class="sharedescription">' + this.description + '</span>' + '</a></h6></section>' + '<iframe class="linkshare" src="http://facebook.com/plugins/like.php?href=' + this.link + '"></iframe>' ).appendto('body'); $('.fbresults section.resultsdescription span:contains(undefined)').remove(); }) }) } $("button.startsearch").click(function() { var searchthis = $('.searchquery').val(); searchfb(searchthis); });
so figured out solution of undefined results. here’s code-
$('.fbresults').find('img[src="undefined"]').remove();
i took care of using enter
/return
initiate search .keypress
function, so-
$("input.searchquery").keypress(function(event) { $('.fbresults').remove(); if (event.which == 13) { //enter event.preventdefault();
that code refreshed results.
thanks received.
Comments
Post a Comment