javascript - Are two functions (one with php) possible with "onclick"? -
i have next script shall fire 2 functions @ same time. 1 function shall call/load php file (index.php query mysql) , other shall run javascript. possible? help in advance.
$.get("index.php", {id : searchform, name : tweetfinder}, function() { // here can other operations onclick("submit"); $('searchform').submit(); }); </script> <form id="searchform" name="tweetfinder"> <div class="input-append"> <input class="span3" autofocus="autofocus"> <button class="btn btn-primary">do stuff!</button> </div></form>
how approach (enter mysql query function?):
function showstuff(){ <?php $get = mysql_query("select * `xxx` `xxx` = '$xxx' order `rank` desc")or die(mysql_error()); while($ass = mysql_fetch_assoc($get)){ $viewer = $ass['playername']; echo "<a href=\"index.php?viewuser=".$viewer."\">".$viewer."</a> , "; };
if willing ajax (jquery) suggest. do, using ajax phone call info of other file , @ callback other operations.
$.get("index.php", {id : 5, name : myname}, function() { // here can other operations alert('do more things'); $('formid').submit(); });
for more details refer here
php javascript forms function
No comments:
Post a Comment