A client whose site we recently rebuilt on WordPress came up with an unusual request: they asked two search forms on each page–one searching the site, the other a catalog on another site.

Fortunately, the Avada theme we used allows you to have a search form in both the header and the footer, so taking care of that part of the request was easy.  It looked to me like the tricky part would be in getting the forms to submit to different locations.

Warning: creating a form that submits data to another site without the site-owner’s knowledge and permission amounts to a cross-site scripting attack.  You’re using your form to inject data into the other site’s code.

Luckily, in the case of the catalog site, the vendor allows customers to create their own off-site search forms and even advises them on how to do it.  Obviously, they’ve taken extra measures to sanitize the posted data, and obviously your form needs extra measures to sanitize the data before it’s posted.  (For this article, I cover only the basics of jQuery, not the extra measures.)  Read more