jquery js ajax 不错的想法
来源:互联网 发布:网络借款平台哪个好 编辑:程序博客网 时间:2024/06/06 12:46
<scriptlanguage="JavaScript"> $(document).ready(function(){ $('#YOUR_FORM').submit(function(){// catch the form's submit event $.ajax({// create an AJAX call... data: $(this).serialize(),// get the form data type: $(this).attr('method'),// GET or POST url: $(this).attr('action'),// the file to call success:function(response){// on success.. $('#DIV_CONTAINING_FORM).html(response);// update the DIV}});returnfalse;});});</script>
EDIT
As pointed out in the comments sometimes the above won't work. So try the following:
<scripttype="text/javascript">var frm = $('#FORM-ID'); frm.submit(function(){ $.ajax({ type: frm.attr('method'), url: frm.attr('action'), data: frm.serialize(), success:function(data){ $("#SOME-DIV").html(data);}, error:function(data){ $("#MESSAGE-DIV").html("Something went wrong!");}});returnfalse;});</script>
0 0
- jquery js ajax 不错的想法
- 知乎几条不错的想法
- hdu4415 不错的想法题
- 基于jquery的ajax.js
- js实现 jquery的$.ajax
- Js原生Ajax和Jquery的Ajax
- js原生ajax与jQuery的ajax
- 不错的BLOG 关于js ajax swfupload 等
- hdu 2158 不错的想法题
- 不错的ajax组件
- Ajax-Js原生Ajax和Jquery的Ajax(一)
- 关于Ajax的一些想法
- 关于AJAX的一些想法
- jQuery不错的插件
- js和jquery ajax的使用
- 原生js和jQuery的AJAX实现
- js和jQuery的AJAX实现
- 关于ajax刷新后破坏瀑布流式布局jquery+masonry的一点想法
- ubuntu 的SSH 服务
- ubuntu ufw 防火墙的设置
- ubuntu上一些好的操作方式 习惯 文件备份
- django1.6 CSRF verification failed. Request aborted. 用出现表单提交
- django1.6 GET url传参 乱码
- jquery js ajax 不错的想法
- django1.6 django-dajaxice的安装配置.
- django1.6 python manage.py collectstatic
- hammer.js教程1
- 屌丝程序员的爱情
- 美联储的路线图(一):衰退与复苏
- apache2 ubuntu log 的地址
- django1.6 static staticfile
- AttributeError: 'module' object has no attribute 'maketrans'