Browse Source

Add an example JS file that gets webmentions

master
Chimo 5 years ago
parent
commit
13908de0ce
1 changed files with 38 additions and 0 deletions
  1. +38
    -0
      webmentions.js

+ 38
- 0
webmentions.js View File

@@ -0,0 +1,38 @@
( function( ) {
"use strict";

var url = document.location.href;

$.ajax(
"http://chromic.org/php/webmention/get.php",
{
type: "POST",
data: {
target: url
},
success: function( data ) {
var i,
len = data.length,
/* $container = $( "#webmentions" ), */
$container = $( "body" ),
html = "<ul>";

if ( len === 0 ) {
return;
}

for ( i = 0; i < len; i += 1 ) {
html += "<li>" + data[ i ] + "</li>";
}

$container
.append( html + "</ul>" )
.show();
},
error: function( xhr, status ) {
window.console.log( "Error fetching webentions: " + status );
}
}
);

}() );

Loading…
Cancel
Save