added more flexible ajax.invoke method