I am going bonkers trying to figure this one out. I know I'm not doing this right. Here's what I've got:

Code:
$(document).submit(function(){
   if($("input[name=type_of_transaction]").val() == "Purchase") {
window.location = "http://www.website.com/thanks1.php";
	}
   if($("input[name=type_of_transaction]").val() == "Refinance") {
window.location = "http://www.website.com/thanks2.php";
	}
});
I can't use an "onClick" function inline with the submit button because the whole form is generated by javascript code that I cannot modify. So instead I am trying to just write something for when a button is submitted on the page, it redirects to page1 or page2 depending on what radio button has been selected as it is being submitted. A specific button would be great, but any button onSubmit is fine because I can't assign an ID to the button.

Any suggestions/corrections?