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

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

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