Quick question: Is it possible to dynamically load content like
<amp-twitter
data-tweetid="611193269532295168"
layout="responsive">
via AJAX
into an AMP
article?
Ajax. Ajax is the traditional way to make an asynchronous HTTP request. Data can be sent using the HTTP POST method and received using the HTTP GET method.
AJAX allows web pages to be updated asynchronously by exchanging data with a web server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page.
ajax({ type: "POST", url: "your url with method that accpects the data", dataType: "json", data: { o: objectDataString }, success: function (data) { alert('Success'); }, error: function () { alert('Error'); } }); And your method can have only one parameter of string type.
While learning about the low-level functionality of Ajax, you build a simple application that employs auto-completion in a text field. Content here has been adapted from Greg Murray's article and sample application from Using Ajax with Java Technology. Ajax stands for Asynchronous JavaScript and XML.
AFAIK, it is not possible but AMP - LIVE-UPDATING AMPS
a new AMP component that updates page content dynamically without additional navigation or reload: readers looking at an earlier version of the page will simply see new updates as they come in.
The amp-live-list component adds support for publishing live updates to AMP pages as new content becomes available in the source document. This works great for implementing live blogs.
In other words, the AMP runtime will poll the server for updates to the origin document, fetching itself. The server can returns the entire AMP page or parts of it, and the runtime updates the page in-place seamlessly.
You can also check a related SO question can AJAX polling be used with AMP? that discusses how to dynamically load updates for the AMP pages.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With