Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 805201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:02:47+00:00 2026-05-15T00:02:47+00:00

I’m writing a simple App Engine app. I have a simple page that allows

  • 0

I’m writing a simple App Engine app.

I have a simple page that allows a user to move a marker on a Google map instance. Each time the user drops the marker, I want to return the long/lat to my Python app.

function initialize() {

  ... // Init map

  var marker = new GMarker(center, {draggable: true});
  GEvent.addListener(marker, "dragend", function() {
    // I want to return the marker.x/y to my app when this function is called ..
  });

}

To my (admittedly limited) knowledge, I should be:

1). Returning a JSON structure with my required data in the listener callback above

2). In my webapp.RequestHandler Handler class, trying to retrieve the JSON structure during the post method.

I would very much like to pass this JSOn data back to the app without causing a page reload (which is what has happened when I’ve used various post/form.submit methods so far).

Can anyone provide me with some psuedo code or an example on how I might achieve what I’m after?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T00:02:47+00:00Added an answer on May 15, 2026 at 12:02 am

    If you don’t want the page to update, then you need to use a XMLHttpRequest. In this example, i’m using the client-side function Request(function_name, opt_argv) and server-side RPCHandler from this Google App Engine example. I haven’t tested this, but it would look like:

    Client-side Javascript

    function initialize() {
    
      ... // Init map
    
      var marker = new GMarker(center, {draggable: true});
      GEvent.addListener(marker, "dragend", function(position) {
        Request('update_marker_position', [ unique_identifier, position.lat(), position.lng() ] );
      });
    
    }
    

    Server-side Python

    # Create database model for LatLng position
    class LatLng(db.Model):
        lat = db.IntegerProperty()
        lng = db.IntegerProperty()
    
    ...
    
    class RPCMethods:
        """ Defines the methods that can be RPCed.
        NOTE: Do not allow remote callers access to private/protected "_*" methods.
        """
    
        def update_marker_position(self, *args):
            # args[0] - unique identifier, say GAE db key
            # args[1] - lat
            # args[2] - lng
            # Note: need to do some checking that lat and lng are valid
            
            # Retrieve key and update position
            position = LatLng.get(db.Key(args[0])
            if position:
                position.lat = args[1]
                position.lng = args[2]
            else:
                position = LatLng(
                    lat= args[1], 
                    lng= args[2]
                )
            position.put()
            
            payload = {
                'lat': args[1],
                'lng': args[2],
            }
            return payload
    

    You’ll need to create the db entry when you serve up the page, and store the db key client side. You could also use some other unique identifier. In this case, I assumed you stored it as a global variable ‘unique_identifier’.

    As well, you’ll need to add a callback function to handle the returning payload (with members ‘lat’ and ‘lng’). From the example, I believe you just add your callback function as the zeroth parameter in the opt_argv array of Request. I hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am writing an app with both english and french support. The app requests
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.