views:

215

answers:

1

As my coding revolves only around one function,the function OnLoad() where the map and search is together on this function. However i was tasked to separate the Maps and Search JS and was unable to do so. Is there any tips or tricks to separating them?

A: 

You could separate your logic in separate .js files or in separate script blocks within the document. Or in separate functions.. Is this what you meant? What in particular are you having trouble with? Using the APIs themselves?

*Edit: I had trouble pasting the code in here so look at the source of this file: http://www.mediafire.com/file/nnfmnnnnymt/search.html

If you open the page and scroll down you will find the map below the search component.

the code is separated into the functions

initializeMap()

and

initializeSearch()

This separation will work just as well into separate .js files, provided you include them in the page.

filip-fku
i have no problems in using the API. However,the coding, for example : code.google.com/apis/ajax/playground/… I am unable to seperate the MAP and SEARCH functions as they work together on the same function. Is there anyway to seperate them into different js files?
cheesebunz
filip-fku
the link i gave in the previous comment, if i have to seperate the OnLoad function into different .js files where one is maps.js and search.js, how am i able to do that? what im asking is that as the search and maps variables and methods all work together as one inside the OnLoad function, and how am i able to put the map coding into the maps.js and as well as the search coding, into the search.js? if i seperate them, they seem to be unable to work.
cheesebunz
Look at my edited answer.
filip-fku
thanks for the help given, will try to work on it.
cheesebunz