[[!getPage? &elementClass=`modSnippet` &element=`competitionList` &totalVar=`total` &tpl=`competitionListRowTpl` &limit=`1` ]] <div class="pageNav">[[!+page.nav]]</div>
<a class="competition-link" data-competitionid="[[+id]]" href="">[[+competitionname]]</a>
$(document).ready(function() { if($(".competition-link").length > 0) { $(".competition-link").click(function(event) { event.preventDefault(); var competitionId = $(this).data('competitionid'); $(".competition-link").remove(); $(".pageNav").remove(); $("#main-wrapper").load('[[~5]]', competitionId); // I'm just chucking competitionId in here as an assumption }); } });
This question has been answered by sottwell. See the first response.
var competitionId = 1; $.ajax({ type: "GET", url: "[[~5]]", data: "compId:"+competitionId, success: function(html) { $('#main-wrapper').replaceWith(html); } });
[[!artworkList? &competitionId=`THE_PASSED_PARAMETER_NEEDS_TO_GO_HERE`]]
var competitionId = location.search.split('compId=')[1]
$.ajax({ type: "POST", url: "myMODXajaxpage.html", data: { name: "John", location: "Boston" } })