I'm having trouble calling jQuery AJAX. My code works fine when I request a page without javascript, but when I have script tags in my code, everything starts to get weird.
It seems that any script tags that link to external URLs are causing browser redirection. In firefox, the page does not fill. In Safari, the page clears and loads the contents of the AJAX response. In both browsers, the URL does not change.
Specifically about my problem; I have a tab control in which I am trying to embed a walkscore widget. Since it is quite heavy on the client side, I want to download it only after the user clicks on the tab. The AJAX walkscore page is as follows:
<script type="text/javascript">
var ws_address = "1 Market St, San Francisco";
var ws_width = "500";
</script>
<script type="text/javascript" src="http://www.walkscore.com/tile/show-tile.php?wsid=MY_WSID">
</script>
script, AJAX? ?
- -
. . :
: index.html walkscore.html
index.html
function widget() {
var widget = $('#walkscore');
$.get('/walkscore.html', function(data) {
$('#loading').slideUp(function() {
widget.html(data);
loaded[name] = true;
widget.slideDown();
});
});
}
walkscore.html -
index.html , . , , js. , js. , js, document.write. , $.getScript, index.html
- -
, , document.write. javascript walkscore document.write jquery.html , , . () js noob. document.write? , script ?