In the past whilst working with AJAX-submitted forms, I have always created the forms in HTML and used the forms own POST function to submitting the actual data to a specific url. - This far is everything is the same as any non-AJAX form.
From that point I have used the jQuery Form plugin together with some basic jQuery code to remove the forms default action (to send the visitor to the form URL) and instead submit the form like a AJAX POST request, that also would return any output from the specific form action URL to the user.
Why is that?
Are there any pros included in sending JSON encoded data requests forwards and backwards instead of doing it the way I've learnt to do it (pure POST data)?
One of the reference videos that i noticed this approach:
Jquery form plugin:
Thanks a lot!
以上就是Different approaches to submitting forms with Ajax的详细内容，更多请关注web前端其它相关文章！