简体   繁体   中英

Newer jQuery version causes a wrong AJAX callback

I'm using this js function to comunicate a web with an Arduino server:

function requestAction(actionId) {
      $.ajax({
        type: 'get',  
        //contentType:  'text/javascript',  
          url: "http://192.168.2.102/requestAction",
          data: { "actionId" : actionId  },
          success:function(json) {
            jsonpRefPR(json);
          },
          processData: false,
          dataType: "jsonp",
          jsonp: "callback",
          jsonpCallback: "jsonpRefPR",

      error:function() {
        alert("An error ocurred while requestAction()!");
      }
    });
}

with the jQuery v1.4.2 works like a charm and I have the following Request url:

http://192.168.2.102/requestAction?callback=jsonpRefPR&actionId=0

which is just what the Arduino expects, so everething works.

BUT when I use the newer jQuery v1.9.1, I got the following wrong Request url:

http://192.168.2.102/requestAction?callback=jsonpRefPR&[object%20Object]&_=1378730663347

so the Arduino doesn't "underestand" this URL and I got an error in the AJAX function...

What's wrong?!

删除processData参数 - 您不需要它并且它阻止正确序列化data

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