I need to make a page with a sidebar on the left, and a search page on the right. I need to be able to perform a search and have the results appear without refreshing the content in the chat frame on the left. Ideally, I need these pages to be able to talk to each other so that a link from the frame on the left can invoke a search on the right. Right now I'm using PHP to handle the search functionality on the right, but I can use any language really.
I looked at iframes, but I was really hoping to have the "search" page be the main page so that the scrollbar in the browser reflects the position on the search page.
I also thought maybe this could be done with AJAX, but since my search box is a form, I wasn't sure how to pass parameters to the page that shows the results.
Hopefully this makes sense, I'll clarify what I can. Thank you!
You can still use ajax. Consider jQuery:
HTML Search Form:
<form id="searchForm">
<input name="searchterm" />
<input type="submit" value="Search" >
</form>
HTML Search Results Container:
<div id="searchResults"></div>
jQuery:
$('#searchForm').on('submit', function(e) {
var $form = $(this);
e.preventDefault();
$.ajax({
url : '/path/to/search.php',
type : 'post',
data : $form.serialize(),
success : function (data) {
$('#searchResults').html(data); // or parse out your data into HTML if it isnt already sent that way
}
});
});