[[!ShowProject]]
<?php
//Get the resource/project we want to show on our website
$resource = $modx->getObject('modResource',$_POST[rID]);
//The getTVValue is the ID of the template variable.
$FeatImageOne = $modx->resource->getTVValue(2);
//I also need the pagetitle
$pageTitle = $modx->resource->get('pagetitle');
//Finally i need the content field
$content = $modx->resource->get('content');
return $modx->getChunk("chunkWorkFrontModalSumm",array(
'pageTitle' => $pageTitle,
'content' => $content,
'FeatImageOne' => $FeatImageOne,
));<div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title" id="myModalLabel">[[+pageTitle]]</h4> </div> <div class="modal-body"> [[+FeatImageOne]] <p>[[+content]]</p> </div> <div class="modal-footer"> </div>
$(document).on("click", ".work-summ-modal", function () {
var myPageId = $(this).data('id');
$.ajax({
async: false,
URL: 'http://www.auspiciousday.com/showproject',
type: 'POST',
data: { rID : myPageId },
dataType: 'html',
timeout: 1000,
cache:false,
error: function(XMLHttpRequest, textStatus, errorThrown){
$("#ShowProject").html("<p>"+errorThrown+"</p>");
},
success: function(allGood){
$("#ShowProject").html(allGood);
}
}) ;
});
This question has been answered by multiple community members. See the first response.
//Get the resource/project we want to show on our website
$output = '';
$rid = $modx->getOption('rID', $_POST, 0);
if ($resource = $modx->getObject('modResource', $rid)) {
//The getTVValue is the ID of the template variable.
$FeatImageOne = $resource->getTVValue(2);
//I also need the pagetitle
$pageTitle = $resource->get('pagetitle');
//Finally i need the content field
$content = $resource->get('content');
$output = $modx->getChunk('chunkWorkFrontModalSumm', array(
'pageTitle' => $pageTitle,
'content' => $content,
'FeatImageOne' => $FeatImageOne,
));
}
return $output;
HTTP/1.1 406 Not Acceptable Server: nginx/1.4.4 Content-Length: 226 Content-Type: text/html; charset=iso-8859-1 Connection: close Date: Tue, 11 Feb 2014 01:37:57 GMT <head><title>Not Acceptable!</title></head><body><h1>Not Acceptable!</h1><p>An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security.</p></body></html>
URL: 'http://www.auspiciousday.com/showproject',
url: 'http://www.auspiciousday.com/showproject',
url: '[[~IDofResource]]',
$.ajax({
async: false,
url: 'http://www.auspiciousday.com/showproject',
type: 'POST',
data: { rID : 28 },
dataType: 'html',
timeout: 1000,
cache:false,
error: function(XMLHttpRequest, textStatus, errorThrown){
$("#test-this").html("<p>"+errorThrown+"</p>");
},
success: function(allGood){
$("#test-this").html(allGood);
}
}) ;
when I change URL to url and put this into my firebug - console:
$.ajax({ async: false, url: 'http://www.auspiciousday.com/showproject', type: 'POST', data: { rID : 28 }, dataType: 'html', timeout: 1000, cache:false, error: function(XMLHttpRequest, textStatus, errorThrown){ $("#test-this").html("<p>"+errorThrown+"</p>"); }, success: function(allGood){ $("#test-this").html(allGood); } }) ;
it does work
Yes I am using Chrome Dev tools and no errors are being thrown (the digital version of your MODX guide is fantastic btw BobRay!).
