Search the Community
Showing results for tags 'arrays ajax client-side'.
-
Hi to all, I am newbie to web apps, with desktop app experience. Learning as I go with fabulous help from Larry's PHP/SQL book and his JS book. So useful. This forum seems fantastic too. I think I can improve performance by loading the browser with data, stored in JS arrays. Since I am clawing my way forward, any feedback early on will be invaluable. My app is about text management--creating custom comments on a person. A user comes to my site to select a group of people in a team and create a custom comment about each of them, based on job performance. The user needs to simply copy the new custom comment to the clipboard and paste it into another website (Yes, it would be better to write the text to the other website and No, I don't have access to that site). The customized comments are never stored in MySQL, they only need to be generated on demand. The names and the stock comments are stored in MySQL. Here's my app model. I have already developed proof-of-concept code (or tested widgets) for the functionality and know it will work, my question is about any unanticipated pitfalls, and performance. App launches: User selects team of people Server side: use AJAX to retrieve list of team members, list of stock comments Client side: use JS arrays to store list of people and list of comments In browser: JS element: display only a list of people Event: User selects person. Result: causes stock comment is written to a new JS text element, and a custom Copy to clipboard button is created Event: button click. Result: custom comment is put in clipboard, so user can switch to reporting site and paste it in. Repeat. Select next person. Creation of stock comment and new button element. Logout when finished. As you can see, I am using arrays to store data client-side, thinking this will improve performance. Users spend most of their time with the members of one team, so load the browser with the data and don't make unneeded AJAX calls. When a user switches to another team: JS clears the arrays JS removes the recent text and button elements JS clears the list of people AJAX call gets new list of people and stock comments from MySQL JS in browser now has arrays loaded with data. User actions drive events and the process above repeats, until the user logs out. The data needed for team members and for stock comments is relatively small, so JS arrays shouldn't cause a noticeable hit to performance. All of this makes sense to me, but I see nothing like this being done in code snippets in books or on forums...and this makes me nervous! Previous experience suggests a more experienced coder will be able to alert me to pitfalls and guide me toward better design solutions. Any advice will be greatly appreciated! CanuckCoder