Object Object, how not to issue this alert

0

Well, I have pages that send asynchronous requests, but when interrupted they issue an alert [Object Object].

This is a bit of a problem as it appears while the server is directing to the page (like the one the client chose).

Is there a way this does not happen?

I think it's because I expect a return using dataType , (AJAX + JQuery), but that I could not change.

    
asked by anonymous 01.06.2015 / 04:34

1 answer

2

These alerts are not the default behavior of your javascript. You'll have to fiddle with your code and find out who's calling the alert function.

The "Object object" occurs when someone passes an object pro alert instead of a string. The alert function converts its parameter to string and the default JavaScript conversion for any object is [object Object] .

If you just want to do the alerts do not appear to the user an alternative is to replace alert(coisa) with console.log(coisa) .

    
01.06.2015 / 04:55