推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
ysicing
V2EX  ›  Python

ajax post email 后 @被转义了

  •  
  •   ysicing ·
    ysicing · May 14, 2017 · 3586 views
    This topic created in 3464 days ago, the information mentioned may be changed or developed.

    Rt.有什么途径可以避免 @被转义呢。不改 flask 程序代码

    
    	data['cemail'] = $('input[name="cemail"]').val();       
        var $result = $('#result');
    
               $.ajax({
                   url:'/tpush',
                   data: data,
                   type: 'POST',
                   contentType: "application/json",
                   dataType:'json',
                   success:function (data) {
                       if (!data.r){
                           $result.html(data.rs)
                       }else{
                           $result.html(data.error)
                       }
                   }
               });
    

    结果:cname=66655555555&cemail=root%40doge.net&curl=59999999999&text=666666 怎么处理呢 ajax 呢

    8 replies  •  2017-05-14 09:30:44 +08:00
    just1
    just1
    May 14, 2017 via Android
    1
    不用处理,后端接收到的是 @
    springz
    springz
    May 14, 2017
    2
    base64? flask 不改的有点麻烦。因为不转义特殊字符会被丢弃。
    springz
    springz
    May 14, 2017
    3
    后端可以直接拿到数据,但是这哥们想不转义 http post
    also24
    also24
    May 14, 2017
    4
    contentType: "application/json",


    ?????????????
    ysicing
    ysicing
    OP
    May 14, 2017
    5
    @just1 不是 @啊,接受的是%40
    ysicing
    ysicing
    OP
    May 14, 2017
    6
    我看有了加了这个后端可以接收到正常到 @,但是没有
    coderfox
    coderfox
    May 14, 2017 via Android
    7
    你的 Content-Type 不是 json,是 application/x-www-form-urlencoded。MIME 类型标记为这个,后端才会主动 decode escape。
    whileFalse
    whileFalse
    May 14, 2017 via iPhone
    8
    楼上正解。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1877 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 01:29 · PVG 09:29 · LAX 17:29 · JFK 20:29
    ♥ Do have faith in what you're doing.