Skip to content

Instantly share code, notes, and snippets.

@fatihtoprak
Last active October 18, 2019 14:31
Show Gist options
  • Select an option

  • Save fatihtoprak/0db59dd39adcf882686934d0e4033b89 to your computer and use it in GitHub Desktop.

Select an option

Save fatihtoprak/0db59dd39adcf882686934d0e4033b89 to your computer and use it in GitHub Desktop.
amp form push

amp form submission

            return response($return, 200)
                ->header("Content-type", "application/json")
                ->header("Access-Control-Allow-Credentials", "true")
                ->header("Access-Control-Allow-Origin", "*.ampproject.org")
                //->header("AMP-Access-Control-Allow-Source-Origin", $ampxhr)
                ->header("Access-Control-Expose-Headers", "AMP-Access-Control-Allow-Source-Origin");
html part
<form id="xhr-amp-form" method="post" action-xhr="{{$ampxhr}}/cart-amp">

</form>

<div submit-success>
  <template type="amp-mustache">
    Subscription successful!
  </template>
</div>

<div submit-error>
  <template type="amp-mustache">
    Subscription failed!
  </template>
</div>

<button class="btn-add-cart addcart trigger" data-clickable="0" type="submit" name="add-to-cart">
  <i class="ico-shopping-cart"></i> {{__('lang-layout.Basket.Add_To_Basket')}} 
</button>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment