Where do I place this GDownloadURL() function if the .php file in it requires the data submitted in the <form> from the user? As seen in the previous posts, my form currently calls up an ajax function. Would I place this GDownloadURL() within that function? I am using $_GET['municipalite'] in my php and it seems that there needs to be something connecting the form and the php.
On Jul 19, 1:10 pm, Grok Lobster <[email protected]> wrote: > GDownloadUrl(".../php/showXML.php", function(data) { Process xml > here } ... > > On Jul 19, 9:32 am, Pierre <[email protected]> wrote: > > > I'm not working with the same XML file all the time though, I have to > > create the XML corresponding to the search triggered by my form and my > > php script. > > If you visit the following site and click on the search button, I am > > able to create the corresponding XML but don't know how to keep the > > page from opening a new page and just displaying the XML file. I want > > to return that XML into the code to create markers out of it. > > >http://pippin.geog.mcgill.ca/acton/cld/index.html > > > I'm told that there are several ways to do this sort of function but I > > don't know which is best and simplest considering my minimal > > experience. > > > On Jul 16, 2:28 pm, "[email protected]" <[email protected]> > > wrote: > > > > On Jul 16, 10:48 am, Pierre <[email protected]> wrote: > > > > > 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; > > > > This is currently returning: > > > Query: SELECT * FROM markers WHERE municipalite = 'Acton Vale' AND > > > contract = 'Vendre' AND zonage = 'Type 1'<br > > > /><table><tr><th>Municipalite</th><th>Contract</th><th>Zonage</ > > > > th><th>Latitude</th><th>Longtitude</th></tr><tr><td>Acton Vale</ > > > td><td>vendre</td><td>Type 1</td><td>45.638168</td><td>-72.578346</ > > > td></tr><tr><td>Acton Vale</td><td>vendre</td><td>Type 1</ > > > td><td>45.662048</td><td>-72.586670</td></tr><tr><td>Acton Vale</ > > > td><td>vendre</td><td>Type 1</td><td>45.624123</td><td>-72.507019</ > > > td></tr><tr><td>Acton Vale</td><td>vendre</td><td>Type 1</ > > > td><td>45.640358</td><td>-72.567192</td></tr><tr><td>Acton Vale</ > > > td><td>vendre</td><td>Type 1</td><td>45.640690</td><td>-72.577148</ > > > td></tr><tr><td>Acton Vale</td><td>vendre</td><td>Type 1</ > > > td><td>45.661926</td><td>-72.614830</td></tr></table> > > > > Which is html, not xml. If it was xml, you could use an xml parser to > > > return the pieces of it as Mike Williams does in his tutorial: > > > The Basics - Part 3 Loading the data from an XML > > > filehttp://econym.org.uk/gmap/basic3.htm > > > (which Grok Lobster pointed you to earlier in this thread) > > > > Is there a reason you didn't want to do that? There are also examples > > > on how to create the correct xml from a > > > database:http://code.google.com/apis/maps/documentation/javascript/v2/articles... > > > > -- Larry > > > > > } > > > > } > > > > 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-Hidequotedtext - > > > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text - > > -- 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.
