Frage

I have a function which makes a post request to my server when a button is clicked, however I notice in the console log that a single request is being sent to that resource when when it shouldn't have been triggered and I don't know why.

It is seemingly triggered a short time after another function is called which makes a get request to another resource, however that function is fairly simple; I've looked through it on and off for the past couple days and am at a loss and so have just been ignoring it mostly.

It's not really causing interference in the program, it just throws an exception on the server and the request fails which has no reprocussions to the client either, but obviously I don't want that in production and it's bothering me because I just can't figure it out. I really cannot imagine it's being triggered there and it's also strange because it happens some amount of time after that call, not right after as you'd think if it were called by it directly. So anyway, short of stepping through my whole program is there any way to determine what called a function? I'd think it would be a fairly common feature, but I just can't seem to find it if so.

War es hilfreich?

Lösung

You can use console.trace() in the code, or you can't edit the code?

Andere Tipps

Some codes for tracing (each line have such tracing styles on Console):

console.log(object[, object, ...])
console.debug(object[, object, ...])
console.info(object[, object, ...])
console.warn(object[, object, ...])
console.error(object[, object, ...])
....

The official documentation about that (if you use Firebug): https://getfirebug.com/wiki/index.php/Console_API

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top