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 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
});
}
精彩评论