Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is AJAX to load embeds possible in AMP?

Quick question: Is it possible to dynamically load content like

<amp-twitter
  data-tweetid="611193269532295168"
  layout="responsive">

via AJAX into an AMP article?

like image 907
Lukas Avatar asked Nov 18 '16 16:11

Lukas


People also ask

Does AJAX work with HTTP?

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.

What is AJAX used for?

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.

How we can send data to server using AJAX?

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.

Does AJAX work with Java?

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.


1 Answers

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.

enter image description here

enter image description here

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.

like image 149
Mr.Rebot Avatar answered Oct 02 '22 17:10

Mr.Rebot