You can put a little JavaScript on the page which contains a function that
you can call... for example:

define a JsonHandler:

object PointHandler extends JsonHandler {
  def apply(in: Any): JsCmd = in match {
    case JsonCmd("setPoint", _, yourData, _) =>
      /// do something with yourData
      Noop
  }
}

Now, build a stable function to send to the browser:

Script(Function("sendPointToServer", "point", PointHandler.call("setPoint",
JsVal("point"))))


You'll have a JavaScript function, sendPointToServer that you cal with the
point and the rest is automatic.

Thanks,

David

On Wed, Jul 29, 2009 at 2:27 PM, Channing Walton <channingwal...@mac.com>wrote:

>
> Hi,
> I'm working on an app which has a google map which users can use to
> search for locations, and on which I want to place markers.
>
> The asynchronous call is a call to google's geocoder service which
> takes a string to search for from an input field, and a callback
> function that the position will be passed to:
>
>    geocoder.getLatLng(address,showAddress);
>
>  function showAddress(point) {
>  if (!point) {
>          alert(address + " not found");
>    } else {
>      map.setCenter(point, 13);
>    }
>  }
>
> So the issue here is that after map.setCenter I want to make an ajax
> call to retrieve marker data from the server using the 'point'. I
> would like to use lift's javascript abstraction to build this but I'm
> struggling to see how to do it given the asynchronous call.
>
> Any ideas?
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to