You are currently browsing the tag archive for the 'ajax' tag.

Have yet to try this out on any of my websites but think it would be very neat to include on any real estate or e commerce website.

——————————–

AJAX Rating Stars Demo

Examples

Simple form binding

var s1 = new Stars({ maxRating: 5, bindField: ‘myRating’, imagePath: ‘images/’, value: 4.5 });

<script type="text/javascript">
  var s1 = new Stars({
    maxRating: 5,
    bindField: 'myRating',
    imagePath: 'images/',
    value: 4.5
  });
</script>

JavaScript callback function

function rating(val) { alert(‘You rated it ‘ + val + ‘ star(s)!’); } var s2 = new Stars({ maxRating: 5, imagePath: ‘images/’, callback: rating });
<script type="text/javascript">
  function rating(val)
  {
    alert('You rated it ' + val + ' star(s)!');
  }
  var s2 = new Stars({
    maxRating: 5,
    imagePath: 'images/',
    callback: rating
  });
</script>

Sending values through AJAX

function ajaxRating(xml) { var x = xml.responseXML; var xmlRating = x.getElementsByTagName(‘rating’); var rating = xmlRating[0].firstChild.nodeValue; alert(‘You rated it ‘ + rating + ‘ star(s)!’); } var s3 = new Stars({ maxRating: 5, actionURL: ‘rate.php?rating=’, callback: ajaxRating, imagePath: ‘images/’, value: 3 });
<script type="text/javascript">
  function ajaxRating(xml)
  {
    var x = xml.responseXML;
    var xmlRating = x.getElementsByTagName('rating');
    var rating = xmlRating[0].firstChild.nodeValue;
    alert('You rated it ' + rating + ' star(s)!');
  }
  var s3 = new Stars({
    maxRating: 5,
    actionURL: 'rate.php?rating=',
    callback: ajaxRating,
    imagePath: 'images/',
    value: 3
  });
</script>

Read more at: http://www.beauscott.com/examples/RatingStars/

Pages

 

December 2009
M T W T F S S
« Oct    
 123456
78910111213
14151617181920
21222324252627
28293031  

RSS Example RSS Real Estate Feed

  • An error has occurred; the feed is probably down. Try again later.