$.document is null
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>
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.
jQuery library path is incorrect.
I had this problem when using jquery. I emptied the document somewhere in the code like this $(this).empty() and it caused the problem
精彩评论