Reputation: 2896
When I am using xhprof profiling PHP code, it works fine. I reference the documentation written by Lorenzo Alberton, http://techportal.inviqa.com/2009/12/01/profiling-with-xhprof/.
But you know that we always have many Ajax calls in a web application. When I try to include header.php
and footer.php
in this article, how can I prevent it from destroying the Ajax call from the JavaScript client?
Upvotes: 1
Views: 1261
Reputation: 3722
The best way to accomplish this is to program in the exception URLs in your config.php
(https://github.com/preinheimer/xhprof/blob/master/xhprof_lib/config.sample.php)
The application will not display the footer link on those URLs (the feature was designed with this use case in mind).
Upvotes: 0
Reputation: 14480
I had the same exact issue. I fixed it by adding the following lines at the top of the Ajax responding script.
global $_xhprof;
@$_xhprof['display'] = false;
Upvotes: 1
Reputation: 22041
Have you tried to remove the "Profiler Output" link from your code ? xhprof shouldn't be changing anything since It's just a profiler.
You can try a if !is_ajax to hide it on ajax requests.
function is_ajax()
{
return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) AND
strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest');
}
Upvotes: 0