我有下面的脚本,它应该同时激发两个函数。一个函数应该调用/加载一个php文件(index.php来查询一个mysql),另一个应该运行一个javascript。这甚至有可能吗?感谢您的帮助提前。两个函数(一个用php)可能与“onclick”?
$.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> , ";
};
与JavaScript不,你不能调用PHP函数,你需要学习客户端和服务器端脚本 – 2013-02-14 12:10:30
一个新的URL *之间的差异*提交表单相互矛盾。请解释你试图用什么来实现。 – bfavaretto 2013-02-14 12:11:47
这取决于你的定义同时... – 2013-02-14 12:12:16