mcmuney Posted April 4, 2009 Share Posted April 4, 2009 <input type="text" style="width:290px; border: solid 1px #b1b1b1; height: 17px;" id="searchtags" name="searchtags" value="" /> <input type="image" src="images/search.jpg" onclick="searchImages()"/></div> searchImages() function is called inside a .js file: function searchImagesResponse(originalRequest) { var response = originalRequest.responseText; var divResponse = $('divResponse'); divResponse.innerHTML = response; var loading = $('loading'); loading.style.display = 'none'; } PROBLEM: I can't use the string on the url to directly show the results. For example: site.com/index.php?searchtags=tag_here. What can I do so that I can use the url to show search results? Link to comment https://forums.phpfreaks.com/topic/152495-search-results-using-url/ Share on other sites More sharing options...
xtopolis Posted April 4, 2009 Share Posted April 4, 2009 This looks like an ajax problem.. I'm not sure what you're asking. You want to use an ajax method of searching AND go to the url ? or you just want the users to be able to see the search url, for instance if they want to bookmark it? Both can be done using your javascript function to create and display the appropriate link ... but it seems counterproductive unless I misunderstand. Link to comment https://forums.phpfreaks.com/topic/152495-search-results-using-url/#findComment-800947 Share on other sites More sharing options...
mcmuney Posted April 4, 2009 Author Share Posted April 4, 2009 You got it right. I want to be able to send the URL to someone with the search results and users to see the URL as well. Currently, there's no way to do that. Link to comment https://forums.phpfreaks.com/topic/152495-search-results-using-url/#findComment-801002 Share on other sites More sharing options...
xtopolis Posted April 4, 2009 Share Posted April 4, 2009 Well... all it is is the same keywords searched.. Didn't you say yourself it was something like: site.com/index.php?searchtags=tag_here ? If so, your search function searchImages() must build url to query somewhere.. so take that query and copy/paste/mail/do whatever with it so that you get what you want.. you know what I mean? Link to comment https://forums.phpfreaks.com/topic/152495-search-results-using-url/#findComment-801035 Share on other sites More sharing options...
mcmuney Posted April 4, 2009 Author Share Posted April 4, 2009 I found the code, but I'm not sure what to change to show the URL. I want to point out that if I manually enter the path now (site.com/index.php?searchtags=tag_here), it does not show any results: function searchImages() { var loading = $('loading'); loading.style.display = 'block'; var searchtags = document.getElementById('searchtags').value; var ip = 0; var url = 'ajax/search.php'; var pars = 'searchtags=' + encodeURIComponent(searchtags); var myAjax = new Ajax.Request( url, { method: 'get', parameters: pars, onComplete: searchImagesResponse }); } Link to comment https://forums.phpfreaks.com/topic/152495-search-results-using-url/#findComment-801040 Share on other sites More sharing options...
xtopolis Posted April 4, 2009 Share Posted April 4, 2009 It will likely be: url + "?" + pars Find a way to get that info returned to you. I don't use jQuery much, but perhaps you could add arguments to searchImagesResponse or something. Link to comment https://forums.phpfreaks.com/topic/152495-search-results-using-url/#findComment-801052 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.