Ok guys/gals…
This is like a custom search.
I need help with this one. I have a form that resides in a modal style dialog box (jQuery). When the user changes the select options, I need to trigger the jQuery to push the values to the template and return the results in a div. I can do it with hard coded values, but not with variables in the query or the .load.
Without trying to bore people with code, it is a standard select(ddl) with options.
When the user makes a selection, I am trying to catch it like this:
$("#select1, #select2, #select3, #select4").change(function(){
// Check for search data
var variable_a = $("#select1").val().toString();
var variable_b = $("#select2").val().toString();
var variable_c = $("#select3").val().toString();
var variable_d = $("#select4").val().toString();
// Build out query string to pass
var qs = "?";
qs += "variable_a="+variable_a+"&variable_b="+variable_b+"&variable_c="+variable_c+"&variable_d="+variable_d;
// Build the link to pass
var url = "/TemplateGroup/template"+qs;
// Call method to populate users selection
loadResults(url);
});
The loadResults(url) function is here:
function loadResults(url){
$("#myDiv").load(url, function(){
alert("Search Completed");
});
}
I need the template to grab the querystring results and pass them into the query to run and show the results.
The template looks like this:
{exp:query limit="5" sql="SELECT DISTINCT ce.title, m.screen_name, cd.field_id_58 FROM (exp_channel_titles ce, exp_members m, exp_channel_data cd) WHERE ce.site_id = '6' AND ce.channel_id IN (18) AND ce.author_id = m.member_id AND ce.entry_id = cd.entry_id ORDER BY ce.entry_date DESC"}
{title} - {screen_name} - {field_id_58}
{paginate}
Page {current_page} of {total_pages} pages {pagination_links}
{/paginate}
{/exp:query}I figured this would be easier than it is turning out to be. Either that, or my head is just looking at the wrong stuff…
I hope this all makes sense. Thanks a bunch in advance.