Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the ajax validation method for form forms

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

The main content of this article is to explain "what is the ajax verification method of form form". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "what is the form form ajax verification method"!

Var form = $('# updateform')

$("# submitBtn") .click (function () {

/ / validate the form

Var bv = form.data ('bootstrapValidator')

Bv.validate ()

If (bv.isValid ()) {

Console.log (form.serialize ())

/ / send ajax request

$.ajax ({

Url: 'validator.json'

Async: false,// synchronization, which blocks the operation

Type: 'GET',//PUT DELETE POST

Data: form.serialize ()

Complete: function (msg) {

Console.log ('done')

}

Success: function (result) {

Console.log (result)

If (result) {

_ window.location.reload ()

} else {

$("# returnMessage"). Hide (). Html ('modification failed!'). Show (300)

}

}, error: function () {

$("# returnMessage"). Hide (). Html ('modification failed!'). Show (300)

}

})

}

});

At this point, I believe you have a deeper understanding of "what is the ajax verification method of form forms?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report