Jquery Ajax Search on pressing return key in Internet Explorer

Posted by haribo83 on Stack Overflow See other posts from Stack Overflow or by haribo83
Published on 2010-05-31T08:26:01Z Indexed on 2010/05/31 8:32 UTC
Read the original article Hit count: 220

Hi

I have found the following code to create a search on my site - this works really well the only problem is in Internet Explorer the search doesn't work when you press the return key.

Does anybody have any ideas?

The search code is below - if anything else is needed please let me know.

$(function() 
{
$(".search_button").click(function() 
{
var search_word = $("#search_box").val();
var dataString = 'search_word='+ search_word;

if(search_word=='')

{
}
else
{
$.ajax({
type: "GET",
url: "searchdata.php",
data: dataString,
cache: false,
beforeSend: function(html) 

{
document.getElementById("insert_search").innerHTML = ''; 
$("#flash").show();
$("#searchword").show();
$(".searchword").html(search_word);
$("#flash").html('<img src="ajax-loader.gif" /> Loading Results...');

},

success: function(html){
$("#insert_search").show();
$("#insert_search").append(html);
$("#flash").hide();

}


});


}
return false;
});
});

© Stack Overflow or respective owner

Related posts about internet-explorer

Related posts about search