Note that there are some explanatory texts on larger screens.

plurals
  1. POLink for Search Results
    primarykey
    data
    text
    <p>I currently have a job board on my site where users can put in a job title or keyword and a location to search for a job.</p> <p>The results are displayed using Jquery/AJAX without a page refresh. However, I'd like to be able to link to the results for a specific search. For example, if I search for web development positions in OH, I'd like to be able to send a link to someone else who will be able to click on the link and go directly to the page with those results already loaded.</p> <p>I have some knowledge of PHP but none of Ajax or Javascript/Jquery, which is why this is so hard for me. I'm hoping someone can help me with this.</p> <p>Here's the code that is currently displaying the results:</p> <pre><code> jQuery(document).ready(function ($) { // search button clicked jQuery("input[name='indeedsearchbutton']").click(function () { indeedsearchbusy(); indeedsearchcall(); }) // reset page if query changes jQuery("input[name='q']").change(function () { jQuery("input[name='start']").val(1); }) // reset page if location changes jQuery("input[name='l']").change(function () { jQuery("input[name='start']").val(1); }) if (autosearch) { indeedsearchbusy(); indeedsearchcall(); } }) // pagination set start position function setstart(s) { jQuery("input[name='start']").val(s); indeedsearchbusy(); indeedsearchcall(); } // get json data from inputs for ajax call function getdata() { var d = { action: 'indeedcallback', q: (jQuery("input[name='q']").length != 0 ? jQuery("input[name='q']").val() : jQuery("select[name='q']").val()), l: jQuery("input[name='l']").val(), start: jQuery("input[name='start']").val() } return d; } // display json results from ajax call function indeeddisplayresults(resultsjson) { var rpage = ""; if (resultsjson.pagination) rpage += resultsjson.pagination; if (resultsjson.html) rpage += resultsjson.html; if (resultsjson.pagination) rpage += resultsjson.pagination; jQuery("div#indeedsearchresults").html(rpage); } // ajax call to search indeed function indeedsearchcall() { var data = getdata(); jQuery.post(wpajaxurl, data, function (response) { resultjson = eval("(" + response + ")"); if (resultjson) { indeeddisplayresults(resultjson); } }) } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload