Hallo,
when creating functions (in the sense of grouping jQuery commands together) is it better to do it within the "document ready" or outside?
Thx, willi
The tablesorter section isn't quite right. I downloaded the tablesorter 2.0 and was able to get half of that tutorial section running.
$("#large").tablesorter();
rather than .tableSorter();
However, the striping I could not figure out how to make work. I found that striping has been rolled into the zebra widget with the new 2.0, However, adding:
$("#large").tablesorter({
widgets: ['zebra']
});
like on the tablesorter page did not result in a striped table. I also tried adding an 'odd' css class in screen.css but that didn't fix it either.
Hi all
I've a version related problem or so it seems... I tried the Rate me example, and it works fine in firefox and opera, but not in msie (7). when i try the online example it's works all right, but that's jquery version 1.1.2, while the current version is 1.2.3. The rating is entered in the dat-file, so everything appears to work, but the interface then shows:
Thanks for rating, current average: , number of votes:''(so, no vars are printed). At first i thought it was MSIE related, but the online version (1.1.2) works fine, so i guess it must be a problem in the library.
Anyone allready seen and/or solved this?
Regards Michaël
======
Hi everybody,
I'm completely new in Javascript and Jquery, but I'm working on the tutorials to getting used to the language...
I have some problems with the ajax part... I copied the rate.php on my lokal server so I can reach it with http://localhost/rate.php and I changed the jquery-code in the following way:
// generate markup
$("#rating").append("Please rate: ");
for ( var i = 1; i <= 5; i++ )
$("#rating").append("<a href='#'>" + i + "</a> ");
// add markup to container and apply click handlers to anchors
$("#rating a").click(function(e){
// send request
$.post("http://localhost/rate.php", {rating: $(this).html()}, function(xml) {
// format and output result
$("#rating").html(
"Thanks for rating, current average: " +
$("average", xml).text() +
", number of votes: " +
$("count", xml).text()
);
});
// stop normal link click
return false;
});
The html document is getting updated and the script appends the 1 2 3 4 5 and so on in the container, but after click on the numbers, nothing happend...
I looked in the firefox-error-list and I found one error: ret[i].getElementsByTagName is not a function
And I can not get any output of the php-script, and I think I have to create a file with some ratings first, shouldn't I?
Thanks for any help
This is the php file i use...
<?php
define('STORE', 'ratings.dat');
function put_contents($file,$content) {
$f = fopen($file,"w");
fwrite($f,$content);
fclose($f);
}
if(isset($_REQUEST["rating"])) {
$rating = $_REQUEST["rating"];
$storedRatings = unserialize(file_get_contents(STORE));
$storedRatings[] = $rating;
put_contents(STORE, serialize($storedRatings));
$average = round(array_sum($storedRatings) / count($storedRatings), 2);
$count = count($storedRatings);
$xml = "<ratings><average>$average</average><count>$count</count></ratings>";
header('Content-type: text/xml');
echo $xml;
}
?>
I have done a stupid misstake. I used the html file in the normal path, not over the apache, and i think that was the problem... after i moved the complete starterkit folder to my htdocs and tried http://localhost/starterkit/starterkit.html everything was working fine... Würmchen 11:44, 7 January 2008 (PST)
[moved to mailing list]