I am trying to create a basic app for creating and editing contact details - for the purposes of improving my JavaScript skills. For some reason I can't manage to pass variable data from one class to the next - I'm trying to implement something similar to an MVC just to get started before i move to backbone.js
Here's my code:
//App Model Class
var contactsAppModel = 
{
    contacts:contacts,
    /* App Methods */
    init: function()
    {
        var theDetails;
        //initiate App - pull App data
        $j.ajax({
            type: "post",
            url: "inc/contactsModel.php",
            dataType: "html",
            data: '',
            beforeSend: function(url,data) 
            {
                $j('#result').html('<img src="images/page-loader.gif" height="80px" width="80px">').fadeIn('slow');
            }, 
            success: function(data)
            {
                 this.contacts = data;
                 return this.contacts;
            }
        });
        //alert('From WithOut '+this.contacts);
    }
};
//App Class
var contactsApp = 
{
     //App Properties
    contactDetails:'',
     /* App Methods */
    init: function()
    {
        //populate App properties
        this.contactDetails = contactsAppModel.contacts;
        $j('#result').html('<p>Contact Details:</p>'+this.contactDetails).css({'border-color': 'red'}).fadeIn('slow');
        alert('From contactsApp: '+this.contactDetails);
    },
};
How can i access the contents of variable 'data' from the contactsAppModel inside of contactsApp class? I'm trying to implement and OO-based solution to running a Javascript powered App with AJAX - not a functional approach.
 
     
    