使用beforeSend和完整的$。员额? [英] using beforeSend and complete with $.post?

查看:124
本文介绍了使用beforeSend和完整的$。员额?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

或许有使用beforeSend()和完整的()处理与$。员额或你有使用$阿贾克斯呢?

could one use the beforeSend() and complete() handlers with $.post or do you have to use $.ajax for it?

推荐答案

您有2个选项,使用 $。阿贾克斯() $。ajaxSetup()

You have 2 options, use $.ajax() or $.ajaxSetup().

使用$阿贾克斯():

$.ajax({
  type: 'POST',
  url: url,
  data: data,
  success: success
  dataType: dataType
});

或者,您的帖子运行$ .ajaxSetup()之前,但这种影响所有的Ajax请求:

Or, before your post run $.ajaxSetup(), but this affects all ajax requests:

$.ajaxSetup({
   beforeSend: myFunc,
   complete: myCompleteFunc
});

这篇关于使用beforeSend和完整的$。员额?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆