Hi there, I want to ask something about the JSON and the geocoder.. In
my javascript function, everytime I call this, the function calls and
pass some data into a php file via using JSON with this line
/** dont mind the big letters yet **/
(A) new Request( {method: 'post',
url: DOMAIN_URL + 'sample.php?v=' + new Date().getTime(),
onSuccess: function(response){
var jsonarray =
JSON.decode(stripslashes(response));
/** extracting the
content of jsonarray **/
/** I assure you I dont have problems getting the data or decoding the
JSON as well as the closure or the braces of the whole function **/
after getting the data, let us say query = jsonarray[i].data, this
query contains an address which i need to geocode, so i call this line
(B) geocoder.getLatLng(query,function(point){
if(point){
new createTinyMarker2(point, jsonarray[i].color, query,
jsonarray[i].value);
}
}
the createTinyMarker2 is a function to make a customize marker, the
point is the coordinate point of the place if the geocoder is
successful in finding that, the jsonarray[i].color is the color of a
customized marker, the query is the address and the jsonarray[i].value
is just some value that determines what color, and i just need it to
include in my marker for html when the marker is clicked.
one weird thing is that I need to put an (C) "alert(query);" (still
inside that loop of decoding the data from JSON) before calling the
geocoder in order for that to perform its function, if i remove the
alert it wont place the markers on the map but when its there, the
markers actually appears, but i need to remove it. i was wondering if
that alert acts like setTimeout in javascript and if that is the case
then do i need to place a delay for it to geocode?
another thing is that if that line, geocoder is inside that process of
decoding JSON it maps wrong places. does it have its own loop? or how
should I say this.. let say I have a query1 with color1 etc (for the
createTinyMarker2 func) then i have also query2 with color2 etc.. in
the way i see it, the output produces something like query1 with
color2 and query2 with color1, so there is mixing of what supposed to
be not. the marker that is placed in the map may be in the rightplace
but contains wrong info.
here's the code looks like
func produceMarkers(){
/*some codes to add in JSON or JSON.encode*/
then call
(A)
->inside it is getting of data
->(C) /**the weird needed alert**/
->(B)
--> then ending the (A)
}
I know its hard to understand what I'm saying here because as much as
possible I'll try not to break the guideline of posting pure codes.
but if you will permit, i'll post some or complete code of the
function, I'm sorry I cant find a good free web hosting site and this
is only a school project not for a company. if you can help me I'll be
so greatful . thank you very much!
--
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.