简体   繁体   中英

No data send using ajax and old jquery

I'm using a JQuery 3.1.1 by default for a script. For a customer, I must check that my script is compatible with JQuery 1.6.4.

I'm using this to post data :

$.ajax({
  url: base_host, //page de l'API
  method: 'POST',
  data: { param1 : "param1"}
});

It works perfectly fine using JQuery 3.1.1 and, on my ASP site, I can see that Request.ContentLength > 0 . When using JQuery 1.6.4, Request.ContentLength == 0

Any idea why this doesn't work in 1.6.4 or how to make it work ?

The method parameter is not supported before jQuery 1.9.0. You are making a GET request and the data is encoded in the query string.

See the documentation :

You should use type if you're using versions of jQuery prior to 1.9.0.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM