Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracy 2.4 is not capturing/displaying ajax calls made by prototype 1.7.3 library #205

Closed
regiss opened this issue Jun 23, 2016 · 4 comments
Closed

Comments

@regiss
Copy link

@regiss regiss commented Jun 23, 2016

I have tried to initialise ajax call by http://prototypejs.org/ prototype 1.7.3 library simply by modifying this code in /tracy-2.4.0/examples/ajax.php

I can see ajax calls in Chrome Console, but Tracy is not capturing/displaying them. Could you help me to find the problem?

<?php

require __DIR__ . '/../src/tracy.php';

use Tracy\Debugger;

session_start(); // session is required for this functionality
Debugger::enable(Debugger::DETECT, __DIR__ . '/log');


if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) { // AJAX request
    Debugger::barDump('AJAX request');
    if (!empty($_GET['error'])) {
        this_is_fatal_error();
    }
    $data = [rand(), rand(), rand()];
    header('Content-Type: application/json');
    header('Cache-Control: no-cache');
    echo json_encode($data);
    exit;
}

Debugger::barDump('classic request');

?>
<!DOCTYPE html><html class=arrow><link rel="stylesheet" href="assets/style.css">

<h1>Tracy: AJAX demo</h1>

<p>
    <button id="prototype" onclick="prototype_ajax()">AJAX PROTOTYPE request</button> <span id=result>see Debug Bar in the bottom right corner</span>
</p>

<p>
    <button class=error>Request with error</button> use ESC to toggle BlueScreen
</p>

<script src="prototype.1.7.3.js"></script>
<script>

function prototype_ajax()
{
    new Ajax.Request('ajax.php',{
        method: 'post',
        onSuccess: function (transport) {
            var r = transport.responseText.evalJSON();
            console.log(r);
        }
    });
}

</script>


@dg

This comment has been minimized.

Copy link
Member

@dg dg commented Jun 23, 2016

According to https://twitter.com/RadovanKepak/status/742848023642923009 it seems that prototype.js doesn't call getAllHeaders which Tracy uses to detect AJAX.

@regiss

This comment has been minimized.

Copy link
Author

@regiss regiss commented Jun 24, 2016

Is there a easy way to fix it ?

@dg dg closed this in df87a1e Jun 26, 2016
@dg

This comment has been minimized.

Copy link
Member

@dg dg commented Jun 26, 2016

I am not using prototype.js, so this df87a1e is just an attempt.

@regiss

This comment has been minimized.

Copy link
Author

@regiss regiss commented Jun 27, 2016

Wov that was a great attempt. Tracy now works with jQuery and Prototype library.
Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.