Grow your CSS skills. Land your dream job.

Best way to solve this problem

  • # February 6, 2010 at 1:14 pm

    I’m doing something a little different and creating an interactive map for a university using SVG graphics and the JQuery plugin.

    What I am trying to work out is the best way of tying this into a database. Basically what will happen is the map loads, and then when the user hovers over a room, it displays details about the room.

    These details are coming from a database, but I figured that an SQL query every time the user hovers over a new room is going to be overkill.

    What I have at the moment is that when the map loads all the details about the rooms for that floor are loaded into an XML file, then, when a user hovers over a room, it uses an AJAX call to extract the details from the XML file and display them on the screen. However, I’m worried about server load with this, is there a better alternative anyone can think of?

    # February 6, 2010 at 6:06 pm

    Depends on what type of SQL query you are talking about. If you are query by primary key then it you can literally perform thousands without incurring much cost at all.

    One AJAX call per room sounds as though it might be less than ideal from a users perspective since there will be a ‘lag’ between hovering over the room and the information appearing.

    If you get the entire floor when the page loads and cache it then there will be only one query on the server and the user interface will be very responsive. This would therefore seem to be the ideal case for you.

    Just my 2 pence :D

    # February 6, 2010 at 8:25 pm

    Well what I have kind of decided ono is to query the database then save the result as JSON instead of XML. That way it can be easily queried by Javascript every time a hover occurs without having to go back and call the database query or use an AJAX call

    Cheers for the opinion anyway!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".