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'];
}
?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.