gwt - Calling Java Method from within JSNI method -


i trying call java method within jsni method. not getting type of error window.alert() never gets called.

package com.mywebsite.myapp.client;  public class myapp implements entrypoint(){ /// other stuff....     public native void gettoserver(string trainername)/*-{     $wnd.$.get( "http://testdastuff.dev/trainerstats", { trainer: trainername} )      .fail(function() {         $wnd.console.log("error");     })      .done(function( data ) {           if(data == "nodata"){            alert("no data");           this.@com.mywebsite.myapp.client.myapp::testjsni()();               }     });     }-*/;       public void testjsni(){         window.alert("working");     }  } 

it alerting "no data" know wrong way calling method. cant static method.

inside of done callback have lost this (it point else now).

you need preserve via bind or local variable (var self = this).


Comments

Popular posts from this blog

database - How many Observations in SAS Sample Data Output -

emulation - Android map show my location didn't work -

ios - how to query based on pfobject/pfuser associated with another pfobject in parse.com? -