Javascript – Debug application en Ajax

Une utilisation originale d’AJAX pour tracker un dysfonctionnement entre le client et votre applicatif.

  • Le javascript code :

  • <script Language="JavaScript">
    var from_time = new Date();
    from_time = from_time.getTime();
    function benchmark_loading_time() {
    var to_time = new Date();
    to_time = to_time.getTime();
    var msecs = (to_time - from_time);
    //submit the result
    var req = null;
    try { req = new XMLHttpRequest(); } catch(e) {}
    if (!req) try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {}
    if (!req) try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {}
    req.open("GET", '/benchmark_loading_time.php?msecs=' + msecs + '&url=' + location.href, false);
    req.send(null);
    }
    </script>

  • L’appel dans l’HTML page:


<body onLoad="benchmark_loading_time()>

  • Cote serveur, le script PHP benchmark_loading_time.php se chargera de jouer avec les paramètres msecs et url

Source : lien

Web

Snippet Jquery pour la notation

http://jquery.bassistance.de/jquery-getting-started.html

Rate me: Using AJAX

$(document).ready(function() {
// generate markup
var ratingMarkup = ["Please rate: "];
for(var i=1; i <= 5; i++) {
ratingMarkup[ratingMarkup.length] = "" + i + " ";
}
// add markup to container and applier click handlers to anchors
$("#rating").append( ratingMarkup.join('') ).find("a").click(function(e) {
e.preventDefault();
// send requests
$.post("rate.php", {rating: $(this).html()}, function(xml) {
// format result
var result = [
"Thanks for rating, current average: ",
$("average", xml).text(),
", number of votes: ",
$("count", xml).text()
];
// output result
$("#rating").html(result.join(''));
} );
});
});

App

Jquery en action à travers 50 exemples

Jquery est framework javascript trés efficace.
Voici une liste de ce qu’il est capable de faire grâce à son système de plugins:

  • Sliding panels
  • Meuu
  • Tabs
  • Accordion
  • Slideshows
  • Transition effects
  • Jquery Carousel
  • Color Picker
  • LightBox
  • iframe
  • Form Validation
  • Form Elements
  • Star Rating
  • ToolTips
  • Tables Plugins
  • Draggables, Droppables And Selectables
  • Style Switcher
  • Rounded Corners

En savoir plus

Web

Recent Tweets

Catégories