上代码,上图!

  $.ajax({
            url: "your url which return json",
            type: "POST",
            crossDomain: true,
            data: data,
            dataType: "json",
            success:function(result){
                alert(JSON.stringify(result));
            },
            error:function(xhr,status,error){
                alert(status);
            }
        });

主要就是把datatype 的方式改成‘json’,然后加了一句  crossDomain: true, ok, 我们看下后端如何处理:

近期在项目中遇到这样一问题,关于jsonp跨域问题,get传值是可以的,但post传值死活不行啊,于是网上看了一大堆关于这方面的资料,最终问题得以解决,今天抽空与大家分享下。

另外附上,参考的网址http://stackoverflow.com/questions/3860111/how-to-make-a-jsonp-post-request-that-specifies-contenttype-with-jquery

相关文章:

  • 2021-06-04
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2021-04-03
  • 2021-09-12
  • 2021-06-05
  • 2021-05-17
猜你喜欢
  • 2021-04-18
  • 2022-02-16
  • 2021-11-17
  • 2021-11-03
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
相关资源
相似解决方案