Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [JavaScript]Połączanie warunków javascript
kiepski96
post 30.05.2012, 20:46:25
Post #1





Grupa: Zarejestrowani
Postów: 233
Pomógł: 0
Dołączył: 22.02.2010

Ostrzeżenie: (0%)
-----


Mam 2 skrypty:
Kod
<script type="text/javascript">        
    function streampublish_popup(){
        FB.ui(
        {
            method: 'stream.publish',
            attachment: {
                name: 'Demo Pulish To Wall With Popup And Call Back Function',
                description: (
                               "I have experienced with Share On Wall with Popup windows and would like to share with you. Check it now."
                            ),
                href: "http://4rapiddev.com/facebook-graph-api/facebook-publish-to-wall-with-popup-or-dialog-and-call-back/",
                media: [
                    {
                    'type':'image',
                    'src':'http://4rapiddev.com/wp-content/uploads/2011/09/Example-Publish-To-Wall-With-Popup-Windows.jpg',
                    'href':'http://4rapiddev.com/facebook-graph-api/facebook-publish-to-wall-with-popup-or-dialog-and-call-back/'
                    }
                ]
            },
            display: 'popup'
        },
        function(response) {
            if (response && response.post_id) {
$("#filmik").show();
            } else {
$("#notfilmik").show();
            }
        });
    }
</script>


i

Kod
<script>
$(document).ready(function(){
    FB.getLoginStatus(function(response) {
        if (response.status == 'connected') {
            var user_id = response.authResponse.userID;
            var page_id = "452234554793988"; //coca cola
            var fql_query = "SELECT uid FROM page_fan WHERE page_id =" + page_id + " and uid=" + user_id;
            var the_query = FB.Data.query(fql_query);

            the_query.wait(function(rows) {

                if (rows.length == 1 && rows[0].uid == user_id) {
                    $("#filmik").show();

                    //here you could also do some ajax and get the content for a "liker" instead of simply showing a hidden div in the page.

                } else {
                    $("#blokada").show();
                    //and here you could get the content for a non liker in ajax...
                }
            });
        } else {
            // user is not logged in
        }
    });

});
</script>


I teraz chciałbym aby:

Jeśli (response && response.post_id) - to z 1 skryptu and (rows.length == 1 && rows[0].uid == user_id) - to z 2 skryptu to wtedy aby wyświetlało

$("#filmik").show();

Jak to zrobić ?
Jak muszę przerobić kod ?
Proszę o pomoc smile.gif
Go to the top of the page
+Quote Post
IProSoft
post 30.05.2012, 21:55:06
Post #2





Grupa: Zarejestrowani
Postów: 479
Pomógł: 97
Dołączył: 6.09.2011
Skąd: php.net :)

Ostrzeżenie: (0%)
-----


Filmik po udostępnieniu ? smile.gif
Masz jakieś błędy, cokolwiek czy oczekujesz gotowca?


--------------------
Manual prawdę Ci powie.
Go to the top of the page
+Quote Post
kiepski96
post 31.05.2012, 14:53:16
Post #3





Grupa: Zarejestrowani
Postów: 233
Pomógł: 0
Dołączył: 22.02.2010

Ostrzeżenie: (0%)
-----


Chcę połączyć oba skrypty, że aby pojawił się filmik trzeba wykonać polecenia 1 i 2 skryptu, cały czas próbuję ale bez skutku sad.gif
Może chociaż jakieś podpowiedzi, wskazówki ?

Ten post edytował kiepski96 31.05.2012, 14:56:34
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 15.07.2025 - 04:36