How to make so that the function run only one time?
<p>Script number one performed for each of a given set of elements DOM, append to the first element of the DOM script number two. </p>

<p><strong>Script number one:</strong></p>

<pre><code>function ptmedia(){
$('.ptmcss').eq(0).html('&lt;div class="ptmcss"&gt;&lt;/div&gt;')
.append('&lt;div class="append"&gt;&lt;script type="text/javascript" src="script2.js"&gt;&lt;/script&gt;&lt;/div&gt;');
$('.spbin').each(function(){
if($(this).children().attr('class').indexOf('ptmd')!==-1){
$(this).addClass('ptmedia');ptmedia();}
</code></pre>

<p>Script number two does cross domain query, the fulfillment of which performs the specified function <strong>(z)</strong>. 
<strong>Script number two</strong>:</p>

<pre><code>$.getJSON('http://example.com?callback=?',function(z){alert(z.query+'Some text');}
</code></pre>

<p>Due to the fact that the script is the number one multiple times, the function <strong>(z)</strong> holds an equal number of times. How to make so that the function <strong>(z)</strong> run only one time?
Thank's for any help!</p>
