分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 前端开发

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

发布时间:2023-09-06 01:12责任编辑:彭小芳关键词:暂无标签

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:\wamp64\www\lost_and_Found\bootstrap\phpfiles\custom_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:\wamp64\www\lost_and_Found\bootstrap\phpfiles\custom_sendMail.php‘ bgcolor=‘#eeeeec‘>...\custom_sendMail.php<b>:</b>0</td></tr> ???</table></font> ???<pre class=‘xdebug-var-dump‘ dir=‘ltr‘> ???<small>D:\wamp64\www\lost_and_Found\bootstrap\phpfiles\custom_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导致的。

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

原文地址:http://www.cnblogs.com/simuhunluo/p/7551197.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved