jquery ui自动完成导致标头错误
jquery ui Autocomplete causing error with headers
尝试重定向时出错。它是在我安装了一个带有自动完成功能的搜索框后才开始的。当我取出代码时,页面会再次正确重定向。我知道这不是我的php.ini设置。
这是我得到的错误:
警告:无法修改标头信息-标头已由发送(输出开始于/home/content/67/621767/html/nav.php:9)/home/content/67/621767/html/admin/inclutes/functions2.php,第7行
这是导致问题的代码。谢谢你的帮助!
$(function() { $.ajax({
url: "/admin/includes/links.xml",
dataType: "xml",
success: function( xmlResponse ) {
var data = $( "link", xmlResponse ).map(function() {
return {
value: $( "title", this ).text(),
id: $( "url", this ).text()
};
}).get();
$( "#tags" ).autocomplete({source: function (request, response) {
var term = $.ui.autocomplete.escapeRegex(request.term)
, startsWithMatcher = new RegExp("^" + term, "i")
, startsWith = $.grep(data, function(value) {
return startsWithMatcher.test(value.label || value.value || value);
})
, containsMatcher = new RegExp(term, "i")
, contains = $.grep(data, function (value) {
return $.inArray(value, startsWith) < 0 &&
containsMatcher.test(value.label || value.value || value);
});
response(startsWith.concat(contains));
},
select: function( event, ui ) { window.location.href = ui.item.id; }
});
}
});
});
由于您没有发布导致错误的PHP代码,这是我能提供的最好的创可贴解决方案。
在函数2.php中,将ob_start();
放在顶部。这里有一些资源可以解释这一点:
http://brian.moonspot.net/php-ob-start-headers
http://php.net/ob_start
问题不在于javascript,而在于php输出。在您编写标题和发送信息之前,php脚本中有一些内容正在尝试编写(可能是php错误)。php脚本的第7行和第9行是什么?
相关文章:
- ui网格日期单元格过滤器,过滤日期格式导致显示错误的日期
- 使用FB.ui的Facebook Feed对话给出API错误191
- jquery ui自动完成导致标头错误
- jQuery UI对话框错误,按钮导致HierarchyRequestError
- 在选项卡中使用时,Onsen UI拉钩会抛出错误
- Typescript Kendo UI网格列类型错误
- 使用Backbone在模型更改时渲染表单会导致表单UI错误
- 动态创建的 jQuery UI 对话框错误后 jQuery 2.2.0 升级
- 动手错误:在 jquery UI 中启动时,对话框是不可编辑的
- GAS 单击事件处理程序导致 UI Web 应用中出现“意外错误”
- 检测Kendo UI值绑定错误
- Kendo ui:未捕获类型错误:无法读取属性'至小写'的未定义
- 剑道 UI 网格绑定错误
- 如果存在 UI 错误,则禁止或提交记录 Netsuite Suitescript
- 角度 UI 类型提前不起作用 - 没有错误
- JQuery UI - 滑块更改幻灯片上的不透明度 - 错误
- 需要 / 角度 / 业力 / ui-router - 错误:无法从状态“”解析“登陆”
- 相对位置上的 UI.位置值错误
- “初始化前无法在工具提示上调用方法”错误,当我添加 jquery-ui 库时
- 选择类型错误 ui.item undefined Jquery 自动完成