0

I need to call the java method inside the jquery code. How to do that?

I tried by calling java.type, but it is not working. how to pass browser input to the backend java code give some examples var generate = function () {

    var activeTab = $("ul#CronGenTabs li.active a").prop("id");
    var results = "";
    switch (activeTab) {
        case "MinutesTab":
          //  results = "0 0/" + $("#MinutesInput").val() + " * 1/1 * ? *";
          results = Java.type(util.txt.cronGenerator.dailyAtHourAndMinute(MinutesInput))
            break;

1 Answers1

0

In jquery Api you need to do ajax call to invoke your java method.In your case may be yo write a separate method that will make a call to the java method and call in in place of result.

    $.ajax({
    url: "/yourmethodName",
    type: "GET",//method type
    data: "your data, // the data you are sending
    success: function(response){ 
        //handle returned arrayList  //fetch the response to get yoyr data
    },
    error: function(e){  
        //handle error
    } 
});
soorapadman
  • 4,451
  • 7
  • 35
  • 47