From 7d31a709ec2bf2d7d9efc96ce0411d7480c1472b Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Wed, 12 Jun 2019 16:48:23 -0400 Subject: [PATCH] WIP for submitting to ajax Submitting to ajax from form. --- models/admin/member/billing.php | 8 ++++++++ views/admin/billing/accounts.html | 22 ++++++++++++++++++---- views/admin/billing/editAccount.html | 12 ++++++++---- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/models/admin/member/billing.php b/models/admin/member/billing.php index 5ba96f1..ad75e2a 100644 --- a/models/admin/member/billing.php +++ b/models/admin/member/billing.php @@ -663,8 +663,16 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling $account = $Accounts->updateEntry( $_REQUEST['id'] ); if ( !$account['status'] ) { $accountUpdateError = true; + if ( $this->ajaxSide ) { + echo false; + exit; + } } else { $accountUpdated = true; + if ( $this->ajaxSide ) { + echo true; + exit; + } } } diff --git a/views/admin/billing/accounts.html b/views/admin/billing/accounts.html index 499c4fd..03d578e 100644 --- a/views/admin/billing/accounts.html +++ b/views/admin/billing/accounts.html @@ -5,6 +5,9 @@ ul.wp-submenu { body { background-color: rgb(241, 241, 241) !important; } +input[type="text"] { + display: inline; +} {include file='admin/billing/header.html'} @@ -155,22 +158,33 @@ body { $('.account-billing').on('click', function(e){ e.preventDefault(); var member = $(this).data('member'); - console.log( 'member: ', member ); var $modal = $('#glmBillingInfo'); - $.ajax( '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=ajaxBillingInfo&option=account&member=' + member ) - .done(function(resp){ + $.ajax( + '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=ajaxBillingInfo&option=account&member=' + member + ) + .done(function(resp){ $modal.html(resp).foundation('open').trigger('resizeme.zp.reveal'); + $('#billingInfoForm').on('submit', function(){ + var data = $(this).serialize(); + $.ajax( + '{$ajaxUrl}?action=glm_members_admin_ajax' + data + ).done(function(rsp){ + console.log( 'rsp:', rsp ); + }); + return false; + }); } ); return false; }); + $(document).foundation(); }); -
+
diff --git a/views/admin/billing/editAccount.html b/views/admin/billing/editAccount.html index 19ebef6..d3bc000 100644 --- a/views/admin/billing/editAccount.html +++ b/views/admin/billing/editAccount.html @@ -17,10 +17,14 @@ {if $accountAdded}Account Added{/if}
- -
- - + {if $adminAjaxPassthru} + + + {else} + + + + {/if} -- 2.17.1