I have run into a strange problem, I am changing form url after form submission. I have changed form fields and they are changing perfectly but action url is not changing... Here is HTML code..
<form action="" method="post" id="payment-form">
<input type="hidden" id="email" name="email" value="">
....
</form>
JQuery Code
$.ajax({
url: form_url,
type: 'post',
context:this,
data: $("#payment-form").serialize(),
dataType: 'json',
success: function(data) {
if(data.success) {
$('#payment_form').attr("action", data.url);
$('#email').val(data.email);
alert($("#payment-form").attr('action'));
//$("#payment-form").submit();
}
else {
$('#error').html(data.errors).addClass('error').fadeIn("slow").fadeOut(9000);
}
}
});
The alert shows me no url, why is that?
Update
I have setup $('#payment_form').attr("action", data.url);
it shows me no url but alert(data.url)
shows me url.