It is necessary to develop a function that generates a query based on the user's input of "Test" in an INPUT on Site A (SiteA.com) and then redirects to Site B within the same window, passing along the query (SiteB.com/search.aspx?k=test).
Code snippet for SiteA.com
var siteSearch = "SiteB.com/search.aspx";
$("#sitesubmitBtn").click(submitClick);
function submitClick() {
var q = $(location).attr('protocol') + "//" + $(location).attr('hostname') + siteSearch;
var k = $("#sitesearchInput").val();
window.location.href = q + "?k=" + k;
return false;
}
<input name="search" placeholder="Search" id="sitesearchInput" type="text">
<button id="sitesubmitBtn" type="submit></button>