Jquery Ajax uitbreiden

Gestart doorMarv50 reacties70 weergaven

51 berichten · pagina 3 van 4

Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Efferinie schreef:
Eerdere citaten tonen
Rik schreef:
Woops. Foutje in mijn jQuery:
function loadpb(){
        $.ajax({
            url: [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$_CONFIG[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Site_url[/COLOR][COLOR= #007700]];[/COLOR] ?>includes/loadpb.php,
            type: POST, 
            data: type=pb
        }).done(function(msg){
            $("#aantalpb").html(msg);
        
            setTimeout("loadpb()", 7000);
        }
    
    $(document).ready(function(){
        loadpb();
    });

Nog niet? redface Hoe kan dat.

Dan moet je toch echt iets fout doen. Kijk eens in je errorconsole? (of stuur me een demo via PB zodat ik voor je kan debuggen).
0
Thom

Lid

Berichten
10.654
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Volgens mij was de done(); niet afgesloten

toevoeging op 19 maart 2012, 20:55:58:

function loadpb(){
        $.ajax({
            url: [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$_CONFIG[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Site_url[/COLOR][COLOR= #007700]];[/COLOR] ?>includes/loadpb.php,
            type: POST, 
            data: type=pb
        }).done(function(msg){
            $("#aantalpb").html(msg);
 });
        
            setTimeout("loadpb()", 7000);
        }
    
    $(document).ready(function(){
        loadpb();
    });


?
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Thommiee schreef:
Volgens mij was de done(); niet afgesloten
Dit ook inderdaad. Damn ik ben echt aan het slapen vandaag. Ben dan ook in kladblok bezig.
0
Marv

Lid · Topicstarter

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/COLOR][COLOR= #007700]);[/COLOR] 
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]type[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]pb[/COLOR][COLOR= #007700]){[/COLOR]
    [COLOR= #0000BB]$select_unread_pb[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT 1 FROM priveberichten WHERE voor = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$leden[/COLOR][COLOR= #007700]->[/COLOR]getId[COLOR= #007700]([/COLOR][COLOR= #0000BB]$leden[/COLOR][COLOR= #007700]->[/COLOR]getId[COLOR= #007700]()) .[/COLOR] [COLOR= #DD0000]" AND gelezen = 0"[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$select_unread_pb[/COLOR][COLOR= #007700])
    {[/COLOR]
                [COLOR= #0000BB]$aantal[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$select_unread_pb[/COLOR][COLOR= #007700]);[/COLOR]
        
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aantal[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Priv&eacute;berichten (0)[/COLOR][COLOR= #007700];
        }[/COLOR]
        [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aantal[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Priv&eacute;berichten <strong>(1)</strong>[/COLOR][COLOR= #007700];
        }[/COLOR]
        [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aantal[/COLOR] [COLOR= #007700]>[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Priv&eacute;berichten <strong>([/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$aantal[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000])</strong>[/COLOR][COLOR= #007700];
        }
    }
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{
}[/COLOR]    
?>


Dit is loadpb.php

@Thommie Werkt ook niet.
0
Thom

Lid

Berichten
10.654
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Haha lol heb ik ook wel eens
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Klopt

voor = " . $leden->getId($leden->getId())


in je query wel? Want zoniet: dan krijg je natuurlijk ook niets teruggestuurd.
0
Marv

Lid · Topicstarter

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
Rik schreef:
Klopt
voor = " . $leden->getId($leden->getId())


in je query wel? Want zoniet: dan krijg je natuurlijk ook niets teruggestuurd.

dat klopt allemaal. had net toen ik $_GET had getest met ?type=pb en toen werkte het wel.
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Heb je een demo (via PB) zodat ik kan debuggen met errorconsole?
0
Thom

Lid

Berichten
10.654
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Heb je een live demo?
Desnoods in pb?
0
Marv

Lid · Topicstarter

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
Dat gaat een beetje lastig want mijn registratie.php is nog niet klaar.

Kan ik dat zelf niet doen? Debuggen?
0
Thom

Lid

Berichten
10.654
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
F12 + Console en kijken of je een error ziet?
0
Marv

Lid · Topicstarter

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
[21:01:37.870] POST ****includes/loadpb.php [HTTP/1.1 200 OK 94ms]

Staat er telkens.
0
Thom

Lid

Berichten
10.654
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dan moet je iets fout hebben in je loadpb.php bestand?
Heb je wel een html object met "aantalpb" als id?
0
Marv

Lid · Topicstarter

Berichten
3.092
Reputatie
1
Punten
0,21
Lid sinds
Laatst gezien
Efferinie schreef:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/COLOR][COLOR= #007700]);[/COLOR] 
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]type[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]pb[/COLOR][COLOR= #007700]){[/COLOR]
    [COLOR= #0000BB]$select_unread_pb[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT 1 FROM priveberichten WHERE voor = "[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$leden[/COLOR][COLOR= #007700]->[/COLOR]getId[COLOR= #007700]([/COLOR][COLOR= #0000BB]$leden[/COLOR][COLOR= #007700]->[/COLOR]getId[COLOR= #007700]()) .[/COLOR] [COLOR= #DD0000]" AND gelezen = 0"[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$select_unread_pb[/COLOR][COLOR= #007700])
    {[/COLOR]
                [COLOR= #0000BB]$aantal[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$select_unread_pb[/COLOR][COLOR= #007700]);[/COLOR]
        
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aantal[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Priv&eacute;berichten (0)[/COLOR][COLOR= #007700];
        }[/COLOR]
        [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aantal[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Priv&eacute;berichten <strong>(1)</strong>[/COLOR][COLOR= #007700];
        }[/COLOR]
        [URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aantal[/COLOR] [COLOR= #007700]>[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])
        {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Priv&eacute;berichten <strong>([/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$aantal[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000])</strong>[/COLOR][COLOR= #007700];
        }
    }
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{
}[/COLOR]    
?>
Dit is loadpb.php

Sorry hoor maar dat staat gewoon in het topic confused
0
Thom

Lid

Berichten
10.654
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
eh ja maar volgens mij betekend die code in de console dat het gewoon goed is.. dan moet het aan je php bestand liggen of je hebt geen id aantalpb ergens..
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren