javascript - Loading file contains using document ready function not working
I would like to load the following page inside another page after the main page has loaded. I have the following code:
<script language="javascript">
$(document).ready(function(){
$.get('http://$_SERVER[SERVER_NAME]/X.php?logon=Y&vendorref="<?php .$row_RS_Product['id'].?>"&mode=product', function(data) {
$('#tabs-6').html(data);
});
});
</script>
I am not very familiar with this code so please excuse me if I made the obvious mistake
Could anybody help please as it does work when usingfile_get_contents
in php, but this is slowing the page load down tremendous.
Any help welcome
Answer
Solution:
I think you want to get
$_SERVER[SERVER_NAME]
from PHP so you need to add<?php echo
when creating the url to get from. Also you need to haveecho
when opening the php tag to echo, not.
. Dot is used to concat string in php like this"aaa" . "bbb"
(without opening the php tag)So you need something like this: