I have a DataObject that contains some HTMLText and possibly a link to a file for download. When a front end user clicks a link I want a popup to show up and display the DataObject via an ss template. I am not sure how to go about this.
I do know how to make jQuery send an ajax request to a helper Controller that gets the DataObject that the user clicked on. However I don't know how to write the code that will render the DataObject with a template and send the link back to the client computer so that it can open a lightbox or similar with the url of the rendered data. I am not using a PageType for the DataObject.
thanks for your reply. I went through the ajax_basics and everything is working fine. But i am not sure where to go from here? I have got ajaxSnippet.ss Template that will be loaded into a <div> in page.ss. But what i need is to open the thickbox and load the ajaxSnippet.ss into the thickbox.
Link to open thickbox:
<a href="/silverstripe/ajax.php?refid=$ID&height=381&width=613" class="thickbox" title="$Headline">
Link to load asynchronisly content into <div>:
<a href="$URLSegment" onclick="jQuery('#ajaxContent').load('$URLSegment/showImage'); return false;" >
But I'm not sure how the wrapping controls are structured. You're using $URLSegment which returns the Current Page Segment (ie everything after '/silverstripe/' which isn't the full link. You should be forming the link to point to the Dataobject as if it were a page. Silverstripe will see that the call is an AJAX call and render it accordingly. The only problem I can see is Silverstripe may not like the URL Parameters, so another Model Box Plug-in may be more useful.