使用jquery在MVC4中使用加载器表单提交 [英] Form submit on loader in MVC4 using jquery
本文介绍了使用jquery在MVC4中使用加载器表单提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$(document).ready(function () {
// Hide the "busy" Gif at load:
$("#fade").hide();
// Attach click handler to the submit button:
$('#process').click(function () {
$('#myform').submit();
$("#fade").css("display", "block");
$('#fade').css({ 'width': 8000, 'height': 8000 })
.fadeIn(10).fadeTo('slow', 0.7);
// Handle the form submit event, and make the Ajax request:
$("#myform").on("submit", function (event) {
event.preventDefault();
// Show the "busy" Gif:
$("#fade").show();
var url = $(this).attr("action");
var formData = $(this).serialize();
$.ajax({
url: url,
type: "POST",
data: formData,
dataType: "json",
success: function (resp) {
// Hide the "busy" gif:
$("#fade").hide();
// Do something useful with the data:
}
})
});
});
});
<div id="fade" class="fade" style="display: none; text-align: center; z-index: 9999999999;">
<img src='@Url.Content("~/images/loadingg3.gif")' style="top: 60%;position: fixed; left: 1%;" width="150" height="150"/>
</div>
我的尝试:
我想在Loader上提交。点击提交按钮,请给我任何建议。
What I have tried:
I want to for submit on Loader.when click on submit button,please give me any suggestion .
推荐答案
( document )。ready( function (){
// 在加载时隐藏忙Gif:
(document).ready(function () { // Hide the "busy" Gif at load:
( #fade)。hide();
// 将点击处理程序附加到提交按钮:
("#fade").hide(); // Attach click handler to the submit button:
(' #process')。click( function (){
('#process').click(function () {
这篇关于使用jquery在MVC4中使用加载器表单提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文