同時に2つの関数を起動する次のスクリプトがあります。1 つの関数は php ファイル (mysql を照会するための index.php) を呼び出してロードし、もう 1 つの関数は javascript を実行します。これは可能ですか?事前にご協力いただきありがとうございます。
$.get("index.php", {id : searchform, name : tweetfinder}, function() {
// Here you can do the 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>
このアプローチはどうですか (関数として mysql クエリを入力しますか?):
function showstuff(){
<?php
$get = mysql_query("SELECT * FROM `xxx` WHERE `xxx` = '$xxx' ORDER BY `rank` DESC")or die(mysql_error());
while($ass = mysql_fetch_assoc($get)){
$viewer = $ass['playername'];
echo "<a href=\"index.php?viewuser=".$viewer."\">".$viewer."</a> , ";
};