PingPong Javascript Example

71 views
Skip to first unread message

Eric Fazendin

unread,
May 10, 2010, 10:33:56 PM5/10/10
to PingPong IdP Discovery
As the question has come up, I thought I would post an example of what
the javascript looks like that the Service Provider would have on
their PingPong IdP Discovery page. Let me know if you have any
questions:

This example is using jquery:

//------Start-----
function getStatus() {

$.ajax({
url: "PongStatus",
success: function(data) {parseStatus(data);}
});
}

function parseStatus(data) {
$('.pongStatus').html(data);

if (data == "next page") {

if ((page * idpsPerPage) <= totalNumberOfIdps) {
getPage();

setTimeout("getStatus()", 500);
}

} else if (data == "check back") {
setTimeout("getStatus()", 500);
} else {
//data=='no user idps' || data=='get idps'

stopTheAnimation = true;

$(".animatedContainer").fadeOut("fast", function () {
getIdps();
});
}
}

setTimeout("getStatus()", 500);
//-----End-----


The other key part not shown here are the iframes sending the Ping
request and redirecting the Pong responses back to the SP. The
getPage() is a function to make an AJAX call back to the SP to receive
the next set of iframes to load on the page. The getIdps() is a
function to make an AJAX call to retrieve and display the user's IdPs
or to display a complete list of IdPs if no IdPs were found for the
user.
Reply all
Reply to author
Forward
0 new messages