Search

<title> | Grow Your Business window.jQuery || document.write('<script src="http://growyourbusiness.com.au/javascripts/jquery.1.11.3.min.js"><\/script>') $(function() { var keyword = getUrlParameter('q'); var form = new FormData(); form.append("keyword", keyword); var settings = { "async": true, "crossDomain": true, "url": "http://www.growyourbusiness.com.au/php/api-search.php", "method": "POST", "processData": false, "contentType": false, "mimeType": "multipart/form-data", "data": form } $.ajax(settings).done(function(response) { var listOfSearchResults = JSON.parse(response); console.log(listOfSearchResults.length); var html = ''; if(listOfSearchResults.length > 0) { $(listOfSearchResults).each(function(key,value) { if(value.parent_id == '4086') { html += '<li><a href="/staging_2016/masterclasses/'+value.slug+'">' + value.title +'</a></li>'; } else if(value.parent_id == '4044') { html += '<li><a href="/staging_2016/events/'+value.slug+'">' + value.title +'</a></li>'; } }); } else { html += '<li>No results found</li>'; } $('.search-results-container').append(html); $('.search-heading').html('Search results for <em>' + keyword + '</em>'); }); }); function getUrlParameter(sParam) { var sPageURL = decodeURIComponent(window.location.search.substring(1)), sURLVariables = sPageURL.split('&'), sParameterName, i; for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split('='); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : sParameterName[1]; } } }