Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1091893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:36:10+00:00 2026-05-16T23:36:10+00:00

This is a payment form to be posted to Worldpay payment gateway. It has

  • 0

This is a payment form to be posted to Worldpay payment gateway. It has all the parameters as per the WorldPay documentation and it works fine if directly posted.

But, now I am trying to

  • AJAX post the form first to my site (using jquery.form, and that part is working fine) then do some database operations
  • and then change the action attribute using javascript and post it to Worldpay. But the worldpay post is not working and anything alerted after the $("form#wpftuf").submit(); line in the following code is also not alerting too.

The payment form

<form name="wpftuf" id="wpftuf" method="post" action="http://url/of/ajax/file/add_credit"> 
       <input type="hidden" name="operation" value="add_credit" id="operation" /> <?php // for ajax validation ?>
 <input type="hidden" name="worldpayUrl" value="<?php echo WPurl?>" id="worldpayUrl" />
...
..
...other necessary fields
</form>

Here I am passing the worldpay URL as a parameter

The AJAX binding

$(document).ready(function() 
 {

  var options = {
            dataType:  'json',
            beforeSubmit: function()
            {
       //alert("submitting");
      },
            success: function(data)
            {
                if(data)
                {
                 if(data.success)
                 {
                  var worldpayUrl = $("input[id=worldpayUrl]").val();
                            $("form#wpftuf").attr("action",worldpayUrl);

     alert("this works");
                            $("form#wpftuf").submit();

                                        //This alert does not work
                    alert("this alert does not work "+$("form#wpftuf").attr("action"));
                 }
                }
            }
            ,
            error:function()
            {
             alert("validation failed");
            }
        };

  $("form#wpftuf").ajaxForm(options);


 });

I guess the error is happening because I am trying to change the action and submitting inside the ajax form’s success event and the form is still binded.
So, I tried by blindly putting $("form#wpftuf").unbind(options); , $("form#wpftuf").unbind(); $("form#wpftuf").unbind(ajaxForm); after the $("form#wpftuf").attr("action",worldpayUrl); line (one by one) but in all cases I get this error uncaught exception: Permission denied to call method XMLHttpRequest.open

How do I submit the form dynamically to worldpay after the ajax form processing success. Does the form need to be unbinded first? Please help. This may have an easy solution but I am not able to get it. I searched a lot.

Please Note
The worldpay payment gateway needs the user to fill up some forms there after posting, so an AJAX submission again using ajaxSubmit() won’t work. I need a normal form submission there.

Thanks,
Sandeepan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:36:11+00:00Added an answer on May 16, 2026 at 11:36 pm

    i’m not using the malsup plugin, but if i’m right, your problem is the .submit(); when you use an ajax request with form, usually it will be set to take no action return false; so when you submit it, it is still blocked!

    your code should be something like this:

    UPDATED

    $("#wpftuf").submit(function(e) {
        e.preventDefault(); // prevent normal form submission, same as return false;
        $form = $(this);
        var worldpayUrl = $("#worldpayUrl").val(); //get the World Pay php url
        var mySiteFirstUrl = $("#mySiteFirstUrl").val(); //get Your Site First php url
        // if ( valid ) { // make a validation here...
        var posts = $(this).serialize(); // get all form fields in form like: name=value
        //start the first ajax request...
        $.ajax({
            type: "POST",
            url: mySiteFirstUrl,
            data: posts,
            success: function(data) { // send back a json formatted response ?
                var result = $.parseJSON(data); //prepare json
                // if ( result ) { //make another validation here...
                // start making the changes to the form here
                // fill all the form fields with the returned json data...
                $form.attr('action' , worldpayUrl ); //give it the action url ); 
                $form.unbind('submit').submit(); //submit it...
                //}
            }
        });
        //}
    });
    

    in substance use this $("#wpftuf").unbind('submit').submit(); //submit it...

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A lot of this form has specific attributes for my payment provider, but I
This piece of jQuery duplicates an item in a form. It works in all
The WorldPay payment gateway suggests using this HTML to take the customer to the
So this question isn't about integrating an existing payment gateway into my site. This
This is working fine in core php, but not in magento. $party_payment = new
After submitting a payment form (credit cards, etc) to our payment gateway, we receive
I am getting this error from eway token payment API, soap:ReceiverServer was unable to
I'm working on a recurring payment integration with Paypal and at this point the
Can you send a paypal payment with a script? I've been googling for this,
For this Java code: stmt.addBatch( INSERT INTO Bills (BillDateTime, Table, Item, NoAttended, Service, Payment,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.