Refresh an asset with AJAX

Besides sending DeliveryType DELIVERY_TYPE_ASSET in values when posting with ajax what should I do in order to be able to refresh the content of a specific asset?

First example (question): first line of dashboard/views/setting/index.php is

$this->RenderAsset('Messages');

So, how can I refresh the asset 'Messages' without refreshing the view 'index'?

Second example (question): the asset container 'Panel' is usually full of modules. How can I refresh the content of a specific one?

Tagged:

Best Answer

  • ToddTodd Chief Product Officer Vanilla Staff
    Accepted Answer

    We don't currently have a way to pick individual assets or modules in a standardized way.

    To grab a module you can usually go through the module controller. So as an example you could do the following:

    $('.BoxCategories').get(gdn.url('/module/categoriesmodule?DeliveryType=VIEW'));
    

    The message module is a bit tougher since I think it needs to know the page context to know what messages to render. This would be a good extension to program.

Answers

  • ToddTodd Chief Product Officer Vanilla Staff
    Accepted Answer

    We don't currently have a way to pick individual assets or modules in a standardized way.

    To grab a module you can usually go through the module controller. So as an example you could do the following:

    $('.BoxCategories').get(gdn.url('/module/categoriesmodule?DeliveryType=VIEW'));
    

    The message module is a bit tougher since I think it needs to know the page context to know what messages to render. This would be a good extension to program.

Sign In or Register to comment.