0

I have a form in the content of the ajax response, but when I submit the form, the action does'nt work (redirected to dashboard), form action same page, but when I use this form without Ajax, then it works fine, thanks for help

<form class="wrapper" method="GET" name="go_to_print_page" id="go_to_print_page" action="<?php echo $createAction; ?>">
     <input name="send_customer_id" class="send_customer_id" type="hidden" value="<?php echo   $customerId; ?>" />
     <input name="form_key" type="hidden" value="<?php  echo $this->getFormKey() ?>" />
     <button type="submit" class="submit"><?php echo __("View");?></button>
</form>

AJAX REQUEST

  jQuery.ajax({
             url: url,
             type: "POST",
             data: {createdFrom:createdFrom,createdTo:createdTo},
             showLoader: false,
             cache: false,
             success: function(response){
             jQuery('#printTable_wrapper').html(response.output);
             jQuery('#printTable_wrapper').trigger('contentUpdated');
             });
  • $createAction how you create this url? – Sohel Rana Jul 4 at 13:56
  • $createMyAction = $baseUrl.'/cart/printcartinfo/'; – Robinio Tor Jul 4 at 13:58
0

Your URL is wrong. Try following way so you can get correct URL for admin action:

$block->getUrl('cart/printcartinfo');

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.