lundi 2 novembre 2015

Where do i declare JS dependencies if the js is in a php if statement

Below is a sample of a popup alert id like to use,im not certain where i define the dependencies of the script, is it in head? what do i do if there is no html on the page for me to have a head section ?

if ($rowcount== 0)
{
echo ("<script>
    $(function(){
        $.jAlert({
            'title': 'nada',
            'content': 'nada',
            'closeOnEsc': false,
            'closeOnClick': false
        });
        $.jAlert({
            'title': 'click',
            'content': 'click',
            'closeOnClick': true
        });
        $.jAlert({
            'title': 'esc',
            'content': 'esc',
            'closeBtn': false,
            'closeOnEsc': true
        });
        errorAlert('test alert');
        successAlert('Hi!', 'You did it!');
        alert('test alert');
    });


 $connection->close();

 exit;

 }

Aucun commentaire:

Enregistrer un commentaire