I’m getting an error when trying to redirect. It only started after I installed a search box with autocomplete. When I pull the bit of code out, the page redirects properly again. I know it isn’t my php.ini settings.
This is the error I’m getting:
Warning: Cannot modify header information – headers already sent by
(output started at /home/content/67/6231767/html/nav.php:9) in
/home/content/67/6231767/html/admin/includes/functions2.php on line 7
Here is the code that is causing the problem. Thanks for your help!
$(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; }
});
}
});
});
Since you did not post your PHP code that is causing the error, this is the best band-aid solution I can provide.
In your functions2.php, put
ob_start();on top. Here are some resources that will explain this:http://brian.moonspot.net/php-ob-start-headers
http://php.net/ob_start