Jump to content

[SOLVED] jQuery form not working in Firefox/Opera/IE


fabrydesign

Recommended Posts

http://thwhap.fabrydesign.com/

 

I have the center box refreshing with a random database entry. When someone enters something into the form, I'd like it to select a random database entry LIKE whatever is entered. What I have right now only seems to work in Chrome.

 

    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script>
	var onLoad = $(document).ready(function(){
		$('#randomdate').load('date.php');

		var refreshId = setInterval(function(){
			$('#randomdate').fadeOut("slow",function(){$(this).load('date.php?q=' + $('input#search').val(),function(){$(this).fadeIn("slow")})});
		}, 7500);
	});
</script>

 

<?php
if(strlen($_GET['q']) > 1 && $_GET['q'] != 'undefined'){
$q = $_GET['q'];
$query = "SELECT * FROM thwhap_dates WHERE title LIKE '%" . $q . "%' ORDER BY Rand()";
$result = mysql_query($query);
if(mysql_num_rows($result) > 0){
	$row = mysql_fetch_array($result);
	echo '<h2>' . $row['year'] . ' ' . $row['era'] . '</h2>';
	echo $row['title'];
} else {
	echo 'Nothing found for ' . $q . '.';
}
} else {
$query  = "SELECT * FROM thwhap_dates ORDER BY Rand()";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
echo '<h2>' . $row['year'] . ' ' . $row['era'] . '</h2>';
echo $row['title'];
}
?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.