.get and passing variables
This has probably been answered before to death, but I've been searching for hours and can't figure it out. I'm still relatively new to jQuery so appreciate any help. What I want to do is pass variables to a template through .get and have that template render the variables through php in that template, and then have the template be incorporated back into the template it was called from.
What I'm having issues with is figuring out how to pass the variables dynamically through checking boxes and not hardcoding them.
- $(document).ready(function() {
- $(":checkbox, :radio").click(loadEntries);
- $("select").change(loadEntries);
- });
- function loadEntries () {
- var params = $(":input").serializeArray();
- var search_status = $.param(params);
- $.get('template_name/db_entries', search_status);
- ...(more code)
.get asks to pass the variables like this:
- { name: "John", time: "2pm" }
but serialize() and serializeArray() put it in a different format like this:
- single=Single&multiple=Multiple&multiple=Multiple3&post_status=publish&post_title=about&radio=radio1
Please help if possible. Thanks.