zoukankan      html  css  js  c++  java
  • ajax接收php返回得到一堆html代码

    ajax接收php返回得到一堆html代码

    一、      错误代码:

    <font size='1'><table class='xdebug-error xe-notice' dir='ltr' border='1' cellspacing='0' cellpadding='1'>    
        <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: Undefined variable: _SESSION in D:wamp64wwwlost_and_Foundootstrapphpfilescustom_sendMail.php on line <i>11</i></th></tr>    
        <tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>    
        <tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>    
        <tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0004</td><td bgcolor='#eeeeec' align='right'>366336</td><td bgcolor='#eeeeec'>{main}(  )</td><td title='D:wamp64wwwlost_and_Foundootstrapphpfilescustom_sendMail.php' bgcolor='#eeeeec'>...custom_sendMail.php<b>:</b>0</td></tr>    
    </table></font>    
    <pre class='xdebug-var-dump' dir='ltr'>    
    <small>D:wamp64wwwlost_and_Foundootstrapphpfilescustom_sendMail.php:12:</small><font color='#3465a4'>null</font>    
    </pre>    

    二、      为什么出现?

    相信会有人看到一堆代码之后头皮发麻。新手更是不知道如何产生的。

    实际上,既然这是一堆HTML代码,那把它复制到文件中,在浏览器打开不就知道了嘛?

    那怎么复制?因为很多人出现这个错误都是在用ajax提交数据给PHP,PHP返回的乱码数据,往往是alert输出的,在提示框不能复制。

    三、      解决方案

    首先打开Chrome调试,

     

    当发起ajax请求之后,在console便会出现如图所示的日志。点它~(轻点)

    然后出现如图的变化,ajax提交地址对应的php也会显示出来,点击你要提交的那个php。

     

    点击Response就可以复制了。这里可以查看返回的数据。

    另外Headers可以查看提交的数据等信息。

    复制之后到HTML文件中粘贴打开。

     

    哎呦我曹..这不就是PHP出错的提示吗。原来是提交地址PHP逻辑出错。那就改吧。而且,你看上图,把出错的地方以及错误大致类型都指明了。按照说明去修改就OK。我的上图是没有开启seesion_start导致的。

  • 相关阅读:
    如何不传入对象就获得某对象的方法---ThreadLocal类
    Linux系统主目录被更改,怎么修改回去?
    tree命令的安装
    Linux命令学习man
    当重载函数的参数是Object和Object数组的时候会发生什么情况!!!
    Linux学习(二)之内核、系统调用、库
    使用puttygen转换OpenSSH SSH2私钥为RSA PEM格式
    docker-compose使用详解
    svn迁移到gitlab
    linux快速启动http端口
  • 原文地址:https://www.cnblogs.com/simuhunluo/p/7551197.html
Copyright © 2011-2022 走看看