Reputation: 2723
I'm using this function:
$(function echo_content(name, content) {
var random1 = Math.ceil(Math.random()*500);
var random2 = Math.ceil(Math.random()*1000);
alert(content);
$('#TheDiv').show("slow");
});
And i'm calling this function on my webpage like this:
<td>Content <script>echo_content("MyName", "The Content"); </script></td>
The problem is, that the function alerts undefined
instead of The Content
.
What am I doing wrong?
Upvotes: 0
Views: 67
Reputation: 145398
This is not a JQuery DOM ready handler. Just define your function like that:
function echo_content(name, content) {
var random1 = Math.ceil(Math.random() * 500);
var random2 = Math.ceil(Math.random() * 1000);
alert(content);
$("#TheDiv").show("slow");
}
BTW, #TheDiv
block should be loaded before you call the function.
Upvotes: 4