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

php - Webix Data Loading from Laravel Link -

libGdx unable to find files in android application data directory -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -