打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
关于IOS和ANDROID上面使用AJAX的POST小细节

这个小细节花了我30分钟时间排查

哎.....

 

总结:

IOS和ANDROID没有像浏览器支持的那么好,在POST数据的时候,数据体DATA格式中,不能让参数用class命名

错误示范:

 

    $.ajax({
        type: "post",
        url: "http://www.cnblogs.com/../iPhoneReader/GetUserControlHtml.ashx",
        data: { action: this.Action, sort: this.SortType, pi: this.PageIndex, ps: this.PageSize,class:this.ClassType },
        dataType: "html",
        success: function(result) {
            $(contentID).html(result);
            if (flag) {
                resSecurity();
            }
        }
    });

 

注意这里的最后一个参数:  

class:this.ClassType

这样命名是有问题的,IOS和ANDROID是不支持这样请求的

最后调整为:

    $.ajax({
        type: "post",
        url: "http://www.cnblogs.com/../iPhoneReader/GetUserControlHtml.ashx",
        data: { action: this.Action, sort: this.SortType, pi: this.PageIndex, ps: this.PageSize,classtype:this.ClassType },
        dataType: "html",
        success: function(result) {
            $(contentID).html(result);
            if (flag) {
                resSecurity();
            }
        }
    });

 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
十年WEB技术发展历程
jQuery之ajax post篇dff
Android通过反射和注解简化代码编写(一)
AJAX POST&跨域 解决方案
JAVAEE开发之POST/GET提交乱码解决总结
一个jquery-ajax post例子ajax 登陆
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服