分享

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

 quasiceo 2014-09-02

这个小细节花了我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();
            }
        }
    });
复制代码

 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多