Ria Ria - 11 months ago 41
PHP Question

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">
$.get('http://$_SERVER[SERVER_NAME]/X.php?logon=Y&vendorref="<?php .$row_RS_Product['id'].?>"&mode=product', function(data) {

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 using
in php, but this is slowing the page load down tremendous.
Any help welcome

Answer Source

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 have echo 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:

$.get('http://<?php echo $_SERVER[SERVER_NAME]; ?>/X.php?logon=Y&vendorref="<?php echo $row_RS_Product['id']; ?>"&mode=product', function(data) {