Hello, i am a javascript newbie, as well as in php/mysql and i need some help on some web app admin interface i have the task to developp: i have a long list of object: books with properties like title, author, publication date, subject, similar books list with their title and date of publication. how do i generate the list books object after getting that list of books after retrieving it through php from a mysql database and then display that list of books in an HTML table? Then i would like to be able for the user of that admin system to be able to sort the list by title, author, date or even subject? why all of this should be done in JS instead of php, it's because i have been ordered to do dev this in JS by my boss (i ma an intern) i would like to have the layout of the functions i have to write to do this three things! 1-generate javascript objects Books (list?) out of php/mysql! 2-display the list of book in html table (one cell with title, author, publication and subject) and the second cell (lits of similar books with title and date of publication) 3-sorting books by title, author, date or subject Thanks in advance
Now I am trying to understand DOM scripting, so how would you do to display the testlink object content in a two column table? one column for the first three atributes (id_source, id_dest & title_source) ine one cell and the last one (smartlinks_infos) in a second cell? // Example Objet en json var TestlinkJson = {"id_source":"7315f47dba65515fca60c851d7065bc6","url_source":"http:\/\/news.yahoo.com\/s\/afp\/20060822\/od_afp\/chinacateringcultureoffbeat_060822074830","title_source":"Jail-theme teahouse becomes prisoner of own success in China - Yahoo! News","smartlinks_infos":[{"id_dest":"75effc69e8c68b389c65c67119463312","score":"126","deleted":"0","date":"1164279208","zone_cible":"151","manually_added":"0","url_dest":"http:\/\/news.yahoo.com\/s\/afp\/20060825\/od_afp\/malaysiahealthtoilets_060825160532","title_dest":"Malaysia calls for \"toilet revolution\" - Yahoo! News"}]} //fonction de construction de SmartLinks // notice we're now using JSON as the init data function TestLink(json_init) { // init data is used from the init object, e.g. json_init.property this.url_source = json_init.url_source; //l'url du document source du SmartLinks this.title_source = json_init.title_source; // titre du doc source du SmartLinks this.id_source = json_init.id_source; //l'id de la source du SmartLinks // notice Array() -- you need to use the proper constructor // to actually create an array this.smartlinks_info = new Array(); //tableau de liens cible avec info sur la zone, la date etc... } // note I changed the name of the instance var to avoid confusion var testLinkInstance = new TestLink(TestlinkJson); // this will alert saying '[Object]' or something similar, // since you are attempting to alert with an entire object alert(testLinkInstance); Code (markup):