Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$.document is null

Tags:

jquery

When I open my page, I get error: $.document is null. Why? Secondly, is there any way to determine from which path the below given code is loading the file "filevalues.php"?

<script type="text/javascript">
try {
    $(document).ready(function(){
    $("#Edit").click(function(){
    $.get('fetchvalues.php', null, function(){
    alert('reached');
});
});
});
}
catch(e)
{
alert(e.message);
}
</script>
like image 953
RKh Avatar asked Dec 10 '22 18:12

RKh


1 Answers

First of all, there's no such thing as $.document. I take it you mean $(document), since that's what your code says...?

If $(document) doesn't work, your jQuery library isn't being loaded correctly, or it's in conflict with something else that overwrites the value of $. If jQuery(document) also isn't working, then the problem is the former.

Firefox's Firebug is a very good tool to trace down issues like that. You can reload the page and see the request for the jquery js file being made, see exactly what path it is requesting, and exactly what it receives in response.

like image 78
David Hedlund Avatar answered Jan 11 '23 01:01

David Hedlund