Jump to content


  • Posts

  • Joined

  • Last visited

Previous Fields

  • Languages
    PHP, SQL, JavaScript, jQuery, HTML, C++

Contact Methods

  • Website URL

Profile Information

  • Location
  • Interests
    Electronics, Agriculture, Programming, having fun, living life, being happy! :)

DIY-Forum's Achievements


Newbie (1/7)



  1. Sort of got it working... You had it right, but it could not be in the async, had to set a timeout: And the way of calling json was not right, had to change to get any result other than object object. (that probably says itself to most people) Anyways would not have done it without the help with the halway loaded js script. . Thanks for helping. Kristian
  2. Have read it like 5-6 times already. Multiple ID Read RequestsYou can make a single GET request that retrieves multiple nodes by using the ?ids endpoint with the object IDs of those nodes. For example, to lookup the Facebook Developers page and the current session user in a single request, you could use the following Graph API call: GET graph.facebook.com /?ids=platform,me Which is equivalent to the following individual API requests: GET graph.facebook.com /platform GET graph.facebook.com /me The returned data will look something like this: { "me": { "id": "1234567890" ... // Other fields }, "platform": { "id": "19292868552" ... // Other fields } } but thanks, sure I'll figure it out eventually. just not in JS.
  3. Thank you, that seems to have solved something. It does not give any errors, but nothing is showing either, the FB like buttons have dissapeared and the code inspector console tells me nothing so it seems to be ok. Could this have to do with me not calling the right response "type"? I have not much experience with json, but I thought that placing the response to innerHTML of content should give a result. I do not know how they output it, but the result in the fb dev console is like this, { "data": [ { "id": "posterid", "name": "postername", "type": "LIKE" }, plus many more rows like it Thanks
  4. Hey everyone! I am now very frustrated with this code, been on it for hours trying to get it to work. And have searched everywhere for a good tutorial or example on how to connect to fb, but it just won't work with this FB graph library, It loads the like feature GUI, from the SDK CSS "compiler" but it won't recognize the FB.api load. and says no fb sdk loaded anyway so my debugging feature kinda mess my head up even more.. Also this is basically copy and paste from Facebooks own developer guiding sites and the FB.api bit is directly from the copy board of a tested api get call on fbs own dev site so I am as lost as I can get.. What I want to get is basically the output of likes which, if this was working would be returned as a json response here's my code: <html><head> <script> window.fbAsyncInit = function() { FB.init({ appId : 'myappid', xfbml : true, version : 'v2.8' }); }; (function(d, s, id){ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); if (typeof(FB) != 'undefined' && FB != null ) { FB.api( '/mypost/reactions', 'GET', {}, function(response) { document.getElementById("content").innerHTML = response; } ); } else { alert("no fb sdk loaded"); } </script> </head> <body> <div id="content"></div> <div class="fb-like" data-share="true" data-width="450" data-show-faces="true"> </div> </body> </html> Thanks for any help, link, or whatever you've got! Kristian
  5. Aha! so that is why it worked with the delay/settimeout.. I will be more patient with my functions(give them time to load), clean up my code's before asking questions about them, and start logging and tracing the problem on my own before posting! thanks again, yet another day without a long lasting problem Kris
  6. Wow! You are engaged in helping I see, that is awesome!! The first function was just there to show you that I was triggering the function from jquery and that that worked, If I knew anyone would try to code the entire function I would probably have added a shortend version of my own! :)The first function is for informing that a category has been edited and that works fine but the second code i posted var getThisName = 'test value';infoApp('cat_edit',getThisName); which was originally inside a //php execution<?php if($_GET['returndata']=="showorderup"){?>var getThisName = 'test value';infoApp('cat_edit',getThisName);<?php }?> is the one i needed help with,so if I were to post again I would just give you this: <script>$(document).ready(function(){ $('.infomsg').hide();});</script><script>var getThisName = 'test value';infoApp('cat_edit',getThisName);function infoApp(app,usedata){ $('.infomsg').show(); if(app == "cat_edit"){ $('.infomsg').text("Information, "+ usedata +" category was saved"); } $('.infomsg').fadeOut(3600); }</script><body><div class="infomsg"></div></body> And add that when the function infoApp is triggered within a jquery.click function it is working fine.Sorry for not taking time to make it simple from the start. Kris
  7. Only thing left out for the future to work is this: <div class="infomsg"></div> had hoped that would be clear with the $('.infomsg')But will remember to add a complete example for my problem next time, understand it is easier to help when not having to code everything else than the problem too be able to help. Thanks. Kris
  8. This is very weird, in the source now I have the element with the changed value, but still not able to retrive it's data to the log or show it on the page. It seems as the element I autoload is always hidden, while the manually loaded one is fading to 0 opacity before changing to hidden. I decided to check weather it was the fact that I was not triggering the function manually, and it seems that the right way to trigger it automaticly is to do a setTimeout or interval for jQuery to respond. Could that be right? as this works; setTimeout("infoApp('cat_edit',getThisName)",3600); And this dont? infoApp('cat_edit',getThisName); thanks alot for the help on logging, it will really help me in the future! note, the returned log value is still -1 and undefined on style when setTImeout is loading, so I'm not much wiser, though it works Kris
  9. Ok, I added this line and got the value -1 from the log, what does that mean? that there is no element found? console.log($('.infomsg').index()); Edit; I added style to the element and tried to retrive it, but it returns undefined. console.log($('.infomsg').index() + '' + app + usedata + '' + $('.infomsg').attr('style')); I don't know if that is because of the code it self being faulty, but if not then i guess there is no element found? :sEdit 2; console value -1 cat_edit lol undefined Edit3; log value from the first function i posted here, where the function works, 8 cat_edit Electronics font-size: 12px; display: block; I believe that answers the question and that the element is not found when the function is automaticly executed.Should I append a element in the function itself instead of having it outside and hidden to solve the issue?
  10. I thought it could be because I'm triggering the function manually here? $('.save_category_'+ids).click(function(){var getThisName = $('.category_'+ids).val();infoApp('cat_edit',getThisName);});
  11. I will remember to add alerts/log statements to my functions.Yeah, as I said, it works fine in the function above. where I call the exact same function, just different data.
  12. Thanks, It does execute, but it does not load the data or show the "dialog"/div.I checked if it passes the cat_edit and usedata values and it does. but still no error messages on why it is not executing the jquery show();
  13. It is not executed at all. No error messages or warnings
  14. Hello everyone, I'm having a problem executing a function, I have now tried different methods for hours and can't understand anything anymore. Now when I execute the fuction infoApp(); in this function below, then it works. function editCat(ids){ $('.mode').hide(); $('.editmode_'+ids).show(); $('.save_category_'+ids).click(function(){ var getThisName = $('.category_'+ids).val(); infoApp('cat_edit',getThisName); }); } But when I try to execute the funtion automaticly then it does not work.Like this: var getThisName = 'test value';infoApp('cat_edit',getThisName); Here's the function function infoApp(app,usedata){ $('.infomsg').show(); if(app == "cat_edit"){ $('.infomsg').text("Information, "+ usedata +" category was saved"); } $('.infomsg').fadeOut(3600); } Hope anyone got some advice for me.Kris
  • Create New...