如何为post post post请求设置ajaxsetup [英] How to set ajaxsetup for post only post request

查看:370
本文介绍了如何为post post post请求设置ajaxsetup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

How to set ajaxsetup for post only post request







$.ajaxSetup({
           data: { test: "Hello" }
       });



我有在我的.js文件中的ajaxsetup之上。但我想将数据参数附加到我的实际ajax调用只有当请求是POST我怎么做?



我尝试过:




I have the above ajaxsetup in my .js file. But i want to append the data parameter to my actual ajax call only when request is POST how i can do it?

What I have tried:

How to set ajaxsetup for post only post request







$.ajaxSetup({
           data: { test: "Hello" }
       });



我的.js文件中有上面的ajaxsetup。但我想将数据参数附加到我的实际ajax调用只有当请求是POST我怎么办?


I have the above ajaxsetup in my .js file. But i want to append the data parameter to my actual ajax call only when request is POST how i can do it?

推荐答案

.ajaxSetup({
data :{test: Hello}
});
.ajaxSetup({ data: { test: "Hello" } });



我的.js文件中有上面的ajaxsetup。但我想将数据参数附加到我的实际ajax调用只有当请求是POST我怎么做?



我尝试过:




I have the above ajaxsetup in my .js file. But i want to append the data parameter to my actual ajax call only when request is POST how i can do it?

What I have tried:

How to set ajaxsetup for post only post request








.ajaxSetup({
data:{test: Hello}
});
.ajaxSetup({ data: { test: "Hello" } });



我的.js文件中有上面的ajaxsetup。但我想将数据参数附加到我的实际ajax调用只有当请求是POST我怎么能这样做?


I have the above ajaxsetup in my .js file. But i want to append the data parameter to my actual ajax call only when request is POST how i can do it?


这篇关于如何为post post post请求设置ajaxsetup的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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