I've got a form, that sometimes needs to have a button allowing people to authorize with stripe. To save their data I'm submitting the form to a php file, that compiles the auth URL and saves their data. This javascript function is run when the button is clicked:

function stripeAuth(){
    console.log('StripeAuthRun')
    $(".createAlbumForm").get(0).setAttribute("action", "/utils/stripeAuth.php");
    $(".createAlbumForm").submit();
}

It puts StripeAuthRun into the console, and changes the action attribute, but doesn't actually submit the form. The form is valid and can be submitted normally. What am I doing wrong?

Think it may be something with selector (here it is ".createAlbumForm"). Show us according HTML with <form tag.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.