Starts in:
1 DAY
20 HRS
41 MIN
17 SEC
Starts in:
1 D
20 H
41 M
17 S
Open Closed

What’s the best way for redirecting to prepayment page using Ajax ? #1249


User avatar
0
learnabp created

We are using the payment module we have a form which creates a tenant

What is the best way of posting the form to the prepayment page using ajax so that the form can be validated by abp before being sent to the prepayment onpost method.

payment module example uses

localredirectpreservemethod()

the form we have is not in not in a modal it is just on a page.


3 Answer(s)
  • User Avatar
    0
    learnabp created

    well may be this is not the best way .... becuase i am not using Ajax and becuase my form is using the Post method I have written some javasciprt to get over the hurdel of validating the TenantName and confirm password fields.

    var abp = abp || {};
    
    $(function () {
    
        var subscriptionService = window.desertFire.ppm.subscriptions.subscription;
    
        var $frmBuy = $("#frmBuy");
        var $btnRegisterTenant = $("#btnRegisterTenant");
        var $tenantName = $("#txtTenantName");
        var $txtAdminPassword = $("#txtAdminPassword");
        var $txtConfirmAdminPassword = $("#txtConfirmAdminPassword");
    
        $btnRegisterTenant.click(function (e) {
            e.preventDefault();
    
            var isTenantNameAlreadyExist = false;
    
            subscriptionService.isTenantNameAlreadyExist(
    
                $tenantName.val()
    
            ).then(function (isTenantNameAlreadyExist) {
    
                console.log(isTenantNameAlreadyExist);
    
                if (isTenantNameAlreadyExist) {
    
                    abp.message.error("Sorry this Tenant Name: '" + $tenantName.val() + "' already exists, please choose another");
    
                } else if ($txtAdminPassword.val() != $txtConfirmAdminPassword.val()) {
    
                    abp.message.error("The Password do not match, please ensure that the confirm password is the same!");
    
                } else {
    
                    $frmBuy.submit();
    
                }
            });
    
        });
    
    });
    

    Dear Volosoft Team this is method the right approach?

  • User Avatar
    0
    cotur created

    Hi @learnabp

    There are 2 ways to achieve that,

    1. As you did, control it on UI
    2. Using controller. You can post your data to a Controller, then validate and redirect to payment service from your Controller.
  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06