eT` Posted July 3, 2011 Report Share Posted July 3, 2011 Gribētos uztaisīt aptauju lapā bez refresha un submit pogas. Darbotos šādi: <input type="radio" name="a" value="1" onclick="funkcija()"> teksts Kāda apmēram varētu būt funkcija, kas nepārlādējot lapu nosūtītu datus uz citu failu ( kur tie ievietotos datubāzē ), un tad pārlādētos tikai tas bloks, kur ir aptauja ( <div> </div> ) Quote Link to comment Share on other sites More sharing options...
0 eT` Posted July 4, 2011 Author Report Share Posted July 4, 2011 palasīju par jQuery funkcijām un atradu šo load() <script language="javascript" type="text/javascript"> function vote(id) { $('#poll_content').fadeOut('slow').load('<?=HOMEURL?>/vote/'+id).fadeIn('slow'); } </script> Quote Link to comment Share on other sites More sharing options...
0 eT` Posted July 4, 2011 Author Report Share Posted July 4, 2011 (edited) Cita problēma. Šis kods uz IE9 strādā, bet uz gChrome nē o.O <script type="text/javascript" language="JavaScript"> function getCats(id) { if(id!=0) { $('#kat').load('/getcat/'+id); } } </script> <select name="topcat"> <?php $top = query("SELECT rb_topcat_id FROM rb_cat WHERE tips LIKE '%I%' GROUP BY rb_topcat_id"); while($tarr = fetchArray($top)) { $q = query("SELECT * FROM rb_topcat WHERE id=".$tarr[0]); while($arr = fetchArray($q)) { echo '<option onclick="getCats('.$arr["id"].')">'.$arr["name"].'</option>'; } } ?> </select> <div id="kat"></div> mēģināju šādi, bet tas nestrādā nevienā pārlūkā <select name="topcat" onchange="getCats(this.value)"> <?php $top = query("SELECT rb_topcat_id FROM rb_cat WHERE tips LIKE '%I%' GROUP BY rb_topcat_id"); while($tarr = fetchArray($top)) { $q = query("SELECT * FROM rb_topcat WHERE id=".$tarr[0]); while($arr = fetchArray($q)) { echo '<option value="'.$arr["id"].'">'.$arr["name"].'</option>'; } } ?> </select> Edited July 4, 2011 by eT` Quote Link to comment Share on other sites More sharing options...
0 Rincewind Posted July 4, 2011 Report Share Posted July 4, 2011 A tev reāli vajadzīgs tas radio? Apskaties kā notepad.lv aptauja uztaisīta. Quote Link to comment Share on other sites More sharing options...
0 mad182 Posted July 4, 2011 Report Share Posted July 4, 2011 http://api.jquery.com/submit/ Quote Link to comment Share on other sites More sharing options...
0 eT` Posted July 6, 2011 Author Report Share Posted July 6, 2011 (edited) Jauns jautājums: Man ir login forma, kuru validēju ar AJAX Gribētos, lai logins notiek bez lapas pārlādes. success gadījumā laikam vajadzētu ielikt kaut ko, kas to DIVu pārlādētu. pašlaik ir šādi: <script type="text/javascript" language="javascript"> function login() { var user = document.getElementById('email').value; var password = document.getElementById('password').value; $.ajax({ type: "POST", url: "<?=HOMEURL?>/login", data: ({mail : user, pass : password }), success: function(data) { //šeit vajadzētu ielikt, lai pārlādējas #login bloks } }); } </script> <div id="login"> <?php if(empty($_SESSION["logged"])) { ?> <table width="250px"> <tr><td width="50px">E-Pasts</td><td width="200px"><input name="mail" type="text" id="email" /></td></tr> <tr><td width="50px">Parole</td><td width="200px"><input name="pass" type="password" id="password" /></td></tr> <tr><td></td><td><input type="button" value="Ielogoties" onclick="login();" /> <a href="<?=HOMEURL?>/register">Reģistrēties</a></td></tr> </table> <?php } else { echo 'Sveiks,<br /> <a href="'.HOMEURL.'/profile">Mans profils</a><br /> <a href="'.HOMEURL.'/logout">Iziet</a>'; } ?> </div> Edited July 6, 2011 by eT` Quote Link to comment Share on other sites More sharing options...
0 mad182 Posted July 6, 2011 Report Share Posted July 6, 2011 (edited) Nu tad ieliec :) $('#login').html('jaunai login bloka saturs'); Edited July 6, 2011 by mad182 Quote Link to comment Share on other sites More sharing options...
Question
eT`
Gribētos uztaisīt aptauju lapā bez refresha un submit pogas.
Darbotos šādi: <input type="radio" name="a" value="1" onclick="funkcija()"> teksts
Kāda apmēram varētu būt funkcija, kas nepārlādējot lapu nosūtītu datus uz citu failu ( kur tie ievietotos datubāzē ), un tad pārlādētos tikai tas bloks, kur ir aptauja ( <div> </div> )
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.