So I managed to write an AJAX function which calls up the specific
criteria for the markers. The tutorial I found however didn't really
show how to use the resulting queryString and place the variables it
into a createMarker() function to display on the map. For now it
displays the results below the map in string form (as seen here by
clicking Query MySQL button: http://pippin.geog.mcgill.ca/acton/ajax/).
I know it is frowned upon to put code in these forums but I feel that
all I need in this ajaxFunction is some code requesting the variables
for lat lng and creating a marker with them! Once again, any help/
advice would be greatly appreciated!
function ajaxFunction(){
map.clearOverlays();
var ajaxRequest; // Deleted this small section for the purpose of
this post.
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById('ajaxDiv');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
var municipalite = document.getElementById('municipalite').value;
var contract = document.getElementById('contract').value;
var zonage = document.getElementById('zonage').value;
var queryString = "?municipalite=" + municipalite + "&contract=" +
contract + "&zonage=" + zonage;
ajaxRequest.open("GET", "ajax-cld.php" + queryString, true);
ajaxRequest.send(null);
}
On Jul 14, 3:36 pm, Pierre <[email protected]> wrote:
> Alright I'll give these two sites a thorough read!
>
> Thanks for the help!
>
> On Jul 14, 2:37 pm, Rossko <[email protected]> wrote:
>
> > > OK I tried creating an onsubmit=toggleSearch() function which
> > > connected to the php script I wrote (via GDownloadURL()) but it seems
> > > that it won't recognize the $_POST['field'] in my $query line.
>
> > > Is there somewhere in my search.php script that I have to specify
> > > which FORM to connect to or does it automatically go to the FORM with
> > > a method="POST"?
>
> > If you prevent the browser from submitting the form (which you need to
> > do to work in AJAX mode), then nothing happens automatically.
>
> > You can't get to the form from php; php runs in the server and has no
> > access to anything client-side, except what the client sends it. So
> > you need to make changes at the client to send the form data.
>
> > What you need to do is use javascript to get the contents of the form
> > and 'submit' it using GDownloadUrl.
> > You will need to find out how to use javascript to read form values
> > http://www.washington.edu/webinfo/snippets/javascript/formvals.html
> > You will need to find out how to use GDownloadUrl to POST the data to
> > your php script.
> > http://econym.org.uk/gmap/store.htm
>
>
--
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.