MozenRath
MozenRath

Reputation: 10040

passing arguments to dwr call function in javascript with a callback

I have a DWR bean class which i can reference through JavaScript. I also have a function called getWritableContactSQL in that class as

public static string getWritableContactSQL(String, String, String){...}

Now I have the 3 parameters available to be in the JavaScript code. I want to call this function with those parameters and want to use the output of this function into another JavaScript function as :

function slqDone(data){...}

If the getWritableContactSQL function did not have any arguments, I would have called it like:

getWritableContactSQL(sqlDone);

But I have arguments and don't know how to do this. I have practically no knowledge of AJAX.

Upvotes: 0

Views: 5489

Answers (1)

Srikanth Venkatesh
Srikanth Venkatesh

Reputation: 2812

First from the javascript function , java method getWritableContactSQL(a,b,c) will be called.

    DwrUtil.getWritableContactSQL(a,b,c,getWritableContactCallBack);

    getWritableContactCallBack is the callback function.  

After the request is done some data will be returned.This will be returned in the callback function.

    function getWritableContactCallBack(data)
    {
       dwr.util.setValue("divId", "got data", {
                          escapeHtml : false
                        });
    }

Upvotes: 1

Related Questions