I have this HTML ad jquery code
<table width="100%" border="0">
<tr>
<td>Search: <input type="text" name="search" id="search" /> <input type="submit" id="SearchGo" value="Search" /> <input type="reset" name="reset" value="Clear" /></td>
</tr>
</table>
<div id="result"></div>
<script type="text/javascript">
$(function(){
$('input#SearchGo').on('click', function(){
var searchid = $('input.search').val();
var dataString = 'search='+ searchid;
if(searchid!='')
{
$.ajax({
type: "POST",
url: "tickets.php",
data: dataString,
cache: false,
success: function(html)
{
$("#result").html(html).show();
}
});
}return false;
});
jQuery("#result").live("click",function(e){
var $clicked = $(e.target);
var $name = $clicked.find('.name').html();
var decoded = $("<div/>").html($name).text();
$('#searchid').val(decoded);
});
jQuery(document).live("click", function(e) {
var $clicked = $(e.target);
if (! $clicked.hasClass("search")){
jQuery("#result").fadeOut();
}
});
$('#searchid').click(function(){
jQuery("#result").fadeIn();
});
});
</script>
i want to have a live search function so when i click the submit button the page doesnt reload.
this code is on my tickets.php page (same as the post page)
on tickets.php i have the following:
if($_POST) {
//run search query
} else {
//run normal select query
}
but no results are showing