I have a very odd problem where the javascript is executing fine however it also displays the script as text.
The script is within a PHP file that I load with AJAX.
<div id='main_container'>
</div>
<br>
<div style='border-top:1px solid grey;padding-top:10px;padding-bottom:10px;position:absolute;bottom:0;width:100%;'>
<a style='padding-left:10px;padding-right:15px;width:50%;border-right:1px solid #0cf;' onclick='editFav();' href='#'>Edit Favourites</a>
<a style='padding-left:10px;width:50%;text-align:right;' href='#'>Add Favourite</a>
</div>
<script type='text/javascript'>
$('#main_container').load('ajax/favourites/list.php', {});
</script>
The code works fine and the script executes, however it still displays itself..
EDIT - I was able to fix the problem by just adding something after it. I addded "<p></p>
" and it was fine after that.