Javascript Class - Cannot set a property
<p>I have the below code to create a class in javascript.... Now i will only pass the ID of the 'website' and then via an ajax call i will get the rest of the information from the database (JSON ENCODED).</p>

<p>Now my only problem is that when i see whats in the object at the end its only showing the id.</p>

<p>The ajax calls works fine because if i alert this.address after success (ajax) its displaying the result.</p>

<p>What I presume is that I cannot set a property with an ajax request... Can you help?</p>

<pre><code>function website(id) {
     this.id = id; //id


     $.ajax({  //website_information
      type: "GET",
      url: '/proc.php?proc=website_name&amp;id=' + this.id + '',
      success: function(data){
      var tmp = $.parseJSON(data);
     this.address = tmp.website_address;

     this.name = tmp.website_name;
      }
    });

    }

    var obj = new website('20');
    obj.alertwebsite();
    console.log(obj);
</code></pre>
