Object Object, how to not issue this alert

Asked

Viewed 589 times

0

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

This gets in the way a little, because it appears while the server is pointing to the page (like the one the client chose).

There’s a way this can’t happen?

I believe it’s because I expect a return using the dataType,(AJAX + Jquery), but this I could not change.

  • 1

    Look in your code for "Alert", as hugomg referred to that Alert come from your code and not a browser behavior.

1 answer

2


These alerts are not standard behavior of your javascript. You’ll have to sift through your code and find who is calling the function alert.

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

If you only want to make Alerts not appear to the user an alternative is to replace alert(coisa) for console.log(coisa).

  • Perfect, I was asking to alert in case of error in the request, thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.