how can I run a piece of jQuery/ajax when a certain php variable = 1?
Good evening guys,
 
how can I run a piece of jQuery/ajax when a certain php variable = 1 ? *Example* script:  

    if $add_total > < $available_achievement_1 { $achievement_1 = '1' }
        
           if $achievement_1 == '1' {
        
        query submit achievement to users database
        
        }
        else {}

So when $achievement_1 = 1 it runs a query, after that it should run the following jQuery/ajax

    <script type="text/javascript">
    
    
    $(function() {   
     var notice = '<div class="notice">'
        								  + '<div class="notice-body">' 
        									  + '<img src="core/displays/notify/achievement-icon.png" alt="" />'
        									  + '<h3>Achievement item</h3>'
        									  + '<p>details.</p>'
        								  + '</div>'
        								  + '<div class="notice-bottom">'
        								  + '</div>'
        							  + '</div>';
        							  
        						$ny( notice ).purr(
        							{
        								usingTransparentPNG: true
        							}
        						);
    });
    </script>

What's the best way to do this? I'm certain it's possible and probably very easy :) 

Thanks in advance for your advice

how can I run a piece of jQuery/ajax when a certain php variable = 1?
===

Good evening guys,
 
how can I run a piece of jQuery/ajax when a certain php variable = 1 ? *Example* script:  

    if $add_total > < $available_achievement_1 { $achievement_1 = '1' }
        
           if $achievement_1 == '1' {
        
        query submit achievement to users database
        
        }
        else {}

So when $achievement_1 = 1 it runs a query, after that it should run the following jQuery/ajax

    <script type="text/javascript">
    
    
    $(function() {   
     var notice = '<div class="notice">'
        								  + '<div class="notice-body">' 
        									  + '<img src="core/displays/notify/achievement-icon.png" alt="" />'
        									  + '<h3>Achievement item</h3>'
        									  + '<p>details.</p>'
        								  + '</div>'
        								  + '<div class="notice-bottom">'
        								  + '</div>'
        							  + '</div>';
        							  
        						$ny( notice ).purr(
        							{
        								usingTransparentPNG: true
        							}
        						);
    });
    </script>

What's the best way to do this? I'm certain it's possible and probably very easy :) 

Thanks in advance for your advice
