How can I load a new form action from a php function?

How can I load a new form action from a php function?

I am using jQuery ajax to load some page content based on the radio button I click.

I have 2 radio buttons for a payment checkout system:
O - PayPal
O - CreditCard

by default the top radio button is selected on server side page load so the form in the background is set to:

<form id="payproc" action=" http://www.paypal.com/webscr" enctype="multiform/data">
<input type="hidden" name=" price" value="10.00">
<input type="submit" id="submit" name="submit" value="Send">
</form>



If I choose CreditCard, I need to change the form code to:
<form id="payproc" action=" http://secure.authorize.net/trans/" enctype="multiform/data">
<input type="hidden" name=" cost" value="10.00">
<input type="submit" id="submit" name="submit" value="Send">
</form>



To get the new input fields inside the form I can use:
$('#payproc').load('index.php?action=updatePay&shipping=creditcard');

to callback to my php updatePay() function on the server and that works perfectly.


But how do I load a new action url in the form attributes? I need to get it from an ajax request as well, but how do i load it into an attribute of hte form? I've checked the attr function, but I need to get the action url first from an ajax request based on which radio box is selected, but Im not sure how to do that