Php 装载机gif工具

Php 装载机gif工具,php,jquery,Php,Jquery,我在此表单中实现加载程序gif时遇到一些问题。我的表单正在提交到另一个页面,procesor页面。代码如下: <meta http-equiv="Content-Type" content="text/html; charset=windows-1250" /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script> <script

我在此表单中实现加载程序gif时遇到一些问题。我的表单正在提交到另一个页面,procesor页面。代码如下:

<meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
 <script type="text/javascript">
$(document).ready(function(){
$("#myform").validate({
debug: false,
rules: {
name: "required",

},
messages: {
name: "Unesite podatke.",

},
submitHandler: function(form) {
// do other stuff for a valid form
$.post('process.php', $("#myform").serialize(), function(data) {
                                $('#results').html(data);
                            });
                        }
                    });
                });
                </script>
                <style>
label.error { width: 250px; display: inline; color: red; font-family:candara;}
                    </style>


                <!-- We will output the results from process.php here -->
                <br><div id="results"></div>
表格:

<meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
 <script type="text/javascript">
$(document).ready(function(){
$("#myform").validate({
debug: false,
rules: {
name: "required",

},
messages: {
name: "Unesite podatke.",

},
submitHandler: function(form) {
// do other stuff for a valid form
$.post('process.php', $("#myform").serialize(), function(data) {
                                $('#results').html(data);
                            });
                        }
                    });
                });
                </script>
                <style>
label.error { width: 250px; display: inline; color: red; font-family:candara;}
                    </style>


                <!-- We will output the results from process.php here -->
                <br><div id="results"></div>

Ime ili prezime:

<meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
 <script type="text/javascript">
$(document).ready(function(){
$("#myform").validate({
debug: false,
rules: {
name: "required",

},
messages: {
name: "Unesite podatke.",

},
submitHandler: function(form) {
// do other stuff for a valid form
$.post('process.php', $("#myform").serialize(), function(data) {
                                $('#results').html(data);
                            });
                        }
                    });
                });
                </script>
                <style>
label.error { width: 250px; display: inline; color: red; font-family:candara;}
                    </style>


                <!-- We will output the results from process.php here -->
                <br><div id="results"></div>

$(文档).ready(函数(){
$(“#myform”)。验证({
调试:错误,
规则:{
名称:“必需”,
},
信息:{
名称:“Unesite podatke。”,
},
submitHandler:函数(表单){
//为有效的表单做其他事情
$.post('process.php',$(“#myform”).serialize(),函数(数据){
$('#results').html(数据);
});
}
});
});
label.error{宽度:250px;显示:内联;颜色:红色;字体系列:candara;}

所以我想知道在哪里以及如何实现在搜索结果之前显示的加载程序gif

<meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
 <script type="text/javascript">
$(document).ready(function(){
$("#myform").validate({
debug: false,
rules: {
name: "required",

},
messages: {
name: "Unesite podatke.",

},
submitHandler: function(form) {
// do other stuff for a valid form
$.post('process.php', $("#myform").serialize(), function(data) {
                                $('#results').html(data);
                            });
                        }
                    });
                });
                </script>
                <style>
label.error { width: 250px; display: inline; color: red; font-family:candara;}
                    </style>


                <!-- We will output the results from process.php here -->
                <br><div id="results"></div>
这是加载程序gif:

<meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
 <script type="text/javascript">
$(document).ready(function(){
$("#myform").validate({
debug: false,
rules: {
name: "required",

},
messages: {
name: "Unesite podatke.",

},
submitHandler: function(form) {
// do other stuff for a valid form
$.post('process.php', $("#myform").serialize(), function(data) {
                                $('#results').html(data);
                            });
                        }
                    });
                });
                </script>
                <style>
label.error { width: 250px; display: inline; color: red; font-family:candara;}
                    </style>


                <!-- We will output the results from process.php here -->
                <br><div id="results"></div>
<!--LOADER!-->                              


<br><div id="loadingGif" style="display:none; background: url(slike_izgled/transparent_loader.png);" align="center"><img src='ajax-loader.gif'>
<br><font face='candara' size='3'><b>Pretražujem bazu podataka, molim pricekajte...</b></font></div>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>


<script>

$("form").submit(function(e) {
//e.preventDefault();

$("#loadingGif").show();
});

</script>



                <!--LOADER END!-->  



普雷特拉žujem bazu podataka,molim pricekajte。。。 $(“表格”)。提交(功能(e){ //e、 预防默认值(); $(“#加载GIF”).show(); });
在您的submitHandler中使用
$。ajax
而不是
$。post
,您将能够在发送前使用

<meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
 <script type="text/javascript">
$(document).ready(function(){
$("#myform").validate({
debug: false,
rules: {
name: "required",

},
messages: {
name: "Unesite podatke.",

},
submitHandler: function(form) {
// do other stuff for a valid form
$.post('process.php', $("#myform").serialize(), function(data) {
                                $('#results').html(data);
                            });
                        }
                    });
                });
                </script>
                <style>
label.error { width: 250px; display: inline; color: red; font-family:candara;}
                    </style>


                <!-- We will output the results from process.php here -->
                <br><div id="results"></div>
$.ajax({
    type : 'post',
    url : 'your url',
    data : 'your data',
    beforeSend : function(){
        $('#loadingGif').show();
    },
    success : function(data){
        $('#loadingGif').hide();
        // do your stuff here
    }

}))

代码过载。请缩小到您的问题范围。是的,但是页面被重新加载,这就是问题所在。我需要show all:loader,result而不重新加载页面。在$(“#form”)开头添加e.preventDefault()。在结尾提交()或返回false?我已经这样做了,但现在脚本没有处理表单。表格未提交。可能是我的剧本有问题<代码>$.ajax({type:'post',url:'process.php',数据:'#results',beforeSend:function(){$('#loadingGif').show();},success:function(data){$('#loadingGif').hide();$.post('process.php',$(“#myform”).serialize(),function(data){$(“#results”).html(data);}}为什么要提交表单并执行ajax操作?我对ajax和jquery不太了解。
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
 <script type="text/javascript">
$(document).ready(function(){
$("#myform").validate({
debug: false,
rules: {
name: "required",

},
messages: {
name: "Unesite podatke.",

},
submitHandler: function(form) {
// do other stuff for a valid form
$.post('process.php', $("#myform").serialize(), function(data) {
                                $('#results').html(data);
                            });
                        }
                    });
                });
                </script>
                <style>
label.error { width: 250px; display: inline; color: red; font-family:candara;}
                    </style>


                <!-- We will output the results from process.php here -->
                <br><div id="results"></div>