[object Object]

Gestart doorWouterr12 reacties33 weergaven

13 berichten · pagina 1 van 1

Wouterr

Lid · Topicstarter

Berichten
5.274
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien

Eindhoven, Nederland

Hey,

Zoals jullie al weten, ben ik een beetje bezig met Jquery.
Alleen ik krijg een fout, als ik een Dialog met input wil doen.

Ik heb dus dit:
Spoiler tonen
<script>

        function showDialog(naam, meubelid, text)
        {
           $(#dialog-buy).dialog(option, meubelid, meubelid);

           $(#dialog-buy).dialog(option, title, naam);

           document.getElementById(dialogtext).innerHTML = text;
           
           $(#dialog-buy).dialog(open);
        }

    $(function()
        {
     var aantal = $( "#aantal" );

        $( "#error" ).hide();

        $( "#dialog-buy" ).dialog({
            autoOpen: false,
            height: 245,
            width: 350,
            modal: true,
            resizable: false,
            buttons: {
                     "Koop": function()
                                {
                                        $( this ).dialog( "close" );
                                        alert(aantal);
                }
            },
        });
        
        function callback() {
                setTimeout(function() {
        $("#error").fadeOut("slow");
        }, 5000 );
        };
    });
</script>

<div id="dialog-buy" title=".">
<div id="dialogtext"> </div>
<br/>
<center>
Hoeveel wil je er kopen?<br/>
<form>
<input type="text" name="aantal" id="aantal" value="1"/>
</form>
</center>
</div>
Dan krijg ik dus [object Object] maar ik moet de 1 krijgen die als Value staat (of eentje die ze zelf invullen..)

Alvast bedankt.
0
Berichten
13.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
verander var aantal = $( "#aantal" ); naar var aantal = $( "#aantal" ).val();
0
Wouterr

Lid · Topicstarter

Berichten
5.274
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien

Eindhoven, Nederland

Ty!
Is er ook een simpele beveiliging tegen geen nummers?
Dus als iemand xD intypt ofzow, dat het dan gereset word?
Want bij mij (ik weet niet of het aan mij licht yummie) werkt de is_numeric niet goed...
0
Berichten
2.692
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Zoek op google naar is_NaN
0
Wouterr

Lid · Topicstarter

Berichten
5.274
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien

Eindhoven, Nederland

Werkt niet confused.
Als ik fhsjkdahs invul, dan eindicht hij de pagina niet.

if(is_NaN($_GET[aantal]))
   {
   die(json_encode(array("succes"=>"2")));
   }
0
Berichten
2.692
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Snabbotube schreef:
Werkt niet confused.
Als ik fhsjkdahs invul, dan eindicht hij de pagina niet.
if(is_NaN($_GET[aantal]))
   {
   die(json_encode(array("succes"=>"2")));
   }


Oh moest het in PHP emoemoDas wel is_numeric
0
Wouterr

Lid · Topicstarter

Berichten
5.274
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien

Eindhoven, Nederland

Oké.

Ik ga eerst naar school, en dan na school kijk ik verder yummie.
Dit werkt ook niet sadley
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
en ctype_digit?
0
Wouterr

Lid · Topicstarter

Berichten
5.274
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien

Eindhoven, Nederland

[COLOR= #0000BB]<?php
$a[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]aantal[/COLOR][COLOR= #007700]];[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$a[/COLOR] [COLOR= #007700]>=[/COLOR] [COLOR= #0000BB]1[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$a[/COLOR] [COLOR= #007700]<=[/COLOR] [COLOR= #0000BB]100[/COLOR][COLOR= #007700])
{[/COLOR]
[COLOR= #FF8000]//tussen de 1 en de 100[/COLOR]
[COLOR= #007700]}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[COLOR= #FF8000]//niet tussen de 1 of 100 of is geen getal.[/COLOR]
[COLOR= #007700]}[/COLOR]
?>


Werkt dat ook?
Vanaf mijn mobiel in de les.yummie
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Snabbotube schreef:
[COLOR= #0000BB]<?php
$a[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]aantal[/COLOR][COLOR= #007700]];[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$a[/COLOR] [COLOR= #007700]>=[/COLOR] [COLOR= #0000BB]1[/COLOR] [COLOR= #007700]&&[/COLOR] [COLOR= #0000BB]$a[/COLOR] [COLOR= #007700]<=[/COLOR] [COLOR= #0000BB]100[/COLOR][COLOR= #007700])
{[/COLOR]
[COLOR= #FF8000]//tussen de 1 en de 100[/COLOR]
[COLOR= #007700]}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[COLOR= #FF8000]//niet tussen de 1 of 100 of is geen getal.[/COLOR]
[COLOR= #007700]}[/COLOR]
?>
Werkt dat ook?
Vanaf mijn mobiel in de les.yummie
Nee je moet

if (ctype_digit($_GET[bla]))
{
echo "hoi";
}
else
{
echo "doei";
}


Wil je nummers controlen met get? Altijd ctype_digit() gebruiken wink
0
Wouterr

Lid · Topicstarter

Berichten
5.274
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien

Eindhoven, Nederland

Werkt!
Ty biggrin
Ps. Is er ook een INSERT limit?
Dat als je bijvoorbeeld LIMIT 10 invult, dat hij de query 10x uitvoert?
0
Berichten
6.144
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nee, dan moet je met een while.
0
Wouterr

Lid · Topicstarter

Berichten
5.274
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien

Eindhoven, Nederland

Ik gebruik
for ;p
Werkt ook goed.
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