title: Call js function only once in javascript
body: <p>I created js function and now i want that js function to call itself only once, My code is</p>
  
  <pre><code>function view(str){
  
     $.ajax({
        type: "POST",
        url: '&lt;?php echo base_url()?&gt;index.php/main/'+str+'/',
        success: function(output_string){
           //i want to call function from here only once like view(str);
        }
     });
  } 
  </code></pre>
  
  <p>.
  How can i do that ? Thanks in advance, Currently it is showing me infinte loop.</p>