Jump to content

DIY-Forum

Members
  • Content Count

    31
  • Joined

  • Last visited

Everything posted by DIY-Forum

  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
  15. Hello Sir! Thank you very much, works like a charm! I am currently only having one editor on the page, but I notice the "activeEditor" line, does that mean I cannot use more than one? Thanks again, Kris
  16. Hello everyone I have now worked on this trying several options for hours, I have tried tinyMCE.get('.content').getContent(); and regular jquery $('.content').val(); but it still won't work for me. I like the new look of the simple version of tinyMCE so I hope I won't have to give it up just yet! I'm retriving it for saving as: var content = $('.content').val(); I tried to retrive the data from the iframe that tinyMCE makes itself, but that would not work either.. But I might have done it wrong. Hope someone can help me out! Kris
  17. Thanks I managed to get it right, $result=mysql_query("SELECT max(id) as total from `database`.`forumTopics` WHERE category='$outData->id'");$data=mysql_fetch_assoc($result);echo $data['total']; And about upgrading to mysqli, I will do that, but I just learned about that when posting here last week, and yes indeed it has gone over a decade since I learned to code, so guess it's true what you say there! hehe.. I will update my scripts with time, thanks for letting me know though
  18. Ok, I tried to do an fetch_assoc, but is the right way to do that by requesting it like from an array? in that case, I could not get it to work SELECT MAX(id) as maxId FROM table WHERE category='0';$likethis = $assocquery['maxId'];
  19. fetch will not work.. tried assoc too, but that don't work, so I have no idea on how to get the value of Max(id). left it blank for someone to fill out.
  20. Hello again my friends I've had some problems again, I'm trying to select the last id, or the max(id) but it keeps returning resource id. <?php $getLastData = mysql_query("SELECT MAX(id) FROM `database`.`forumTopics` WHERE category='$outData->id'");$getInfo = mysql_fetch_object(mysql_query("SELECT * FROM `database`.`forumTopics` WHERE id='$getLastData'")) or die("Error: ".mysql_error());?> Hope anyone can help Thanks, Kris
  21. Solved it with javascript replace on the textfield for search, onkeyup="this.value=this.value.replace(/s/g,'%')" Edit; This presented a whole lot of new bugs.. Well, I'll do it as you guys said in the beginning, with a loop
  22. maybe i'll actually just use javascript or something to automaticly replace space with % in the textfield..
  23. DIY-Forum

    Sass?

    Okey, I see Thanks Foxy! Kris
  24. DIY-Forum

    Sass?

    Hello everyone I've been wondering about this Sass language, is that usable on the net? it seems that it is very good in limiting the troubles with styling running wild when you have not done it properly in css, like doing every style class in a special order, Sass seems to define every element to be styled alot better, is that right? and should it be used more? If in the case that it should be used more, maybe you should add a category together with css? both on the forum and maybe on the website itself under the css category? Kris
×
×
  • Create New...