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

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

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