开发者

passing arguments to dwr call function in javascript with a callback

开发者 https://www.devze.com 2023-03-29 01:44 出处:网络
I have a DWR bean class which i can reference through JavaScript. I also have a function called getWritableContactSQL in that class as

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 kno开发者_如何学Gowledge of AJAX.


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
                        });
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消