#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2002
    Posts
    40
    Rep Power
    12

    Calling a perl function from within a javascript function


    Hi,

    I'm displaying a geographical map, which is divided in sectors, as apposed to counties, which are more recognisable off course. Therefore I want to display the names of the towns for the particular sector, which has the mouse arrow over it, so that the sector will make more sense to those viewing them. So far I have managed to get the coordinates of the mouse arrow and display them on the screen, by using onmousemove.

    What I want next, is use a perl function at the server side to receive a set of coords from the client and send back to them a list of towns for this sector. This will also check if a new list needs to be sent - because the mouse arrow might still cover the same county.

    First off, can I call a perl function from within a javascript function - the javascript function that is associated with onmousemove. How will the returned list be accessible to the calling function?

    Second off, is this a stupid way of achieving what I want to do. What other ways might it be done? Remember that all the pixels in the map need to be associated with a sector.

    The way I plan to this this would be to create a second map and give each sector a unique color.
  2. #2
  3. SwollenMember
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    the master control
    Posts
    264
    Rep Power
    14
    i am not sure what you are hoping to gain by using perl...since it does not seem that you need to write to the filesystem (server side) anywhere...maybe i misunderstood the question. i think that javascript would be able to do everything you need. javascript can accept parameters from a user, then call a given function. by 'send' do you mean generate a new map?
  4. #3
  5. 11
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jul 2001
    Location
    Lynn, MA
    Posts
    4,635
    Rep Power
    82
    Tron, this question was already asked and answered by a bunch of folks on www.perlmonks.org. Don't waste your breath here.

    It'd be nice if, the next time you post the same question to multiple sites, you let folks know that you're doing it. It's selfish not to.

IMN logo majestic logo threadwatch logo seochat tools logo