I've a form with couple of buttons, on submit it redirect to third party site for authentication. On the submit I want to load that inside iframe on same page. How I can do that?


I think that you can do it with jQuery.

  1. Add this code in your template: <iframe id="frame-id" src="" frameborder="0"></iframe>
  2. Add this jQuery:

    $("#SUBMIT-ID").click(function(e) {
      e.preventDefault();//This prevents the site from being redirected.
      var a_href = $('.A-THAT-HAS-REDIRECT-CLASS').attr('href');
      $("#frame-id").attr("src", a_href);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.