javascript doesn't work until refresh
i have this js code in my html file but it doesn't work until you refresh the page and i dnt know the reason why. here's my code
<script language="javascript" type="text/javascript">
jQuery(function($){
var url = window.location.search.substring(1);
$('#mydiv').load('real_news.asp?'+url);
});
</script>