i am using below code to automatic submit form without refresh but the problem is when i use the manual submit button in form field and submit it just works fine but autosubmit refreshed . i want to submit the form and store the data in mysql. with manual submission and auto submissin data are getting stored but page gets refreshed with auto submission that i dont want
<script type="text/javascript">
window.onload = function() {
setTimeout('document.form1.submit()',10000);
}
</script>
<script type="text/javascript" >
$(function() {
$(".button").click(function() {
var searchBox = $("#searchBox").val();
var dataString = 'searchBox='+ searchBox ;
if(searchBox=='')
{
$('.success').fadeOut(200).hide();
$('.error').fadeOut(200).show();
}
else
{
$.ajax({
type: "POST",
url: "ytitest1.php",
data: dataString,
success: function(){
$('.success').fadeIn(200).show();
$('.error').fadeOut(200).hide();
}
});
}
return false;
});
});
</script>
here is the live link http://way2enjoy.com/try/k/ytitest1.php
i want autosubmit only but page should not refresh