how to replace javascript alerts with a modal box?

The javascript alerts are triggered through an echo depending on some database results

if response is a
{
     <script type="text/javascript">alert("response is a.");</script>
}
else
{
    <script type="text/javascript">alert("response is not a.");</script>
}

I am using bootstrap, if we can replace the alerts with bootstrap modal its perfect


Solution 1:

Took the liberty of creating a jsbin example for you, based on the code you can find in the following question: JavaScript: Overriding alert()

http://jsbin.com/UzUDOno/1/edit

Do note that overriding alert may not be a great idea, especially because you'll be missing out on the blocking properties of regular javascript alerts. As you can see in my example, if you use 2 alerts in quick succession, the last one will override the one(s) before that.