Question : Simple jquery ajax search

For example i have the following something.php which works with smarty:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
<html>
<head>
</head>
<body>
<form action="" method="post" name="search">
<input name="searchbox" type="text" />
<input name="Submit" type="submit" value="Search" />
</form>
<div id="#results">
{$some_var1}, {$somevar2}
</div>
</body>
</html>

When pressed search something.php should return results and assign them to smarty variables. I need tutorial on how to do this using jquery ajax method and update only the content of the #result div "ajax style", how to write and include jquery etc.
P.S. I am perfectly ok with smarty and php, just need the jquery ajax part explanation, how to pass the search param , how to use .get method...

Answer : Simple jquery ajax search

Check this :

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
<html>
<head>
<script language="javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script language="javascript">
	$(document).ready(function() {
		$("input[name='Submit']).click(function() {
			$.get( // we use GET method
				"getResult.php", // the ajax php script returning the result(s)
				{searchValue: $("input[name='searchbox']").val()}, // parameter to send, the search value
				function(data) { // if the ajax call is a success
					$("##results").html(data); // set innerHTML of the div
   				}
			);
		});
	});
</script>
</head>
<body>
<form action="" method="post" name="search">
    <input name="searchbox" type="text" /><input name="Submit" type="submit" value="Search" />
</form>
<div id="#results">{$some_var1}, {$somevar2}</div>
</body>
</html>
Random Solutions  
 
programming4us programming4us