I'm wondering the way i could achieve using <?php?> in javascript for url's? There is a certain route you need to go, Anybody know?

the standard way for instance:

$fetchContent = $('#div').load('website/members #content');

What i am attempting to do:

$fetchContent = $('#grav').load('<?php?> #poppu');

Yep, thats wrong as hell lol, but i am sure someone knows

I'd like to understand how to tie php with javascript, but thats most likely another subject

You stated it right :)

Yep, thats wrong as hell lol, but i am sure someone knows

Anyway, out of your php script, output the url like a javascript code any place in the script prior to the javascript employed for ajax call, e.g.

<?php
    echo '<script language="javascript"> var g_ajax_url = "'. $the_url . '";</script>';
?>

as well as in your javascript, utilize it by doing this

$fetchContent = $('#grav').load(g_ajax_url + ' #poppu');

What it really simply does is define g_ajax_url like a global variable using the proper php value, and you will use that variable inside your js while you use other variables.

To tie php with js directly, try considering xmlrpc subject.

you cannot always "tie" them together simply because they be employed in two different spectrums of processing, php being processed around the server, and javascript being processed within the browser.

You are able to however render javascript inside a php file.

in case your javascript is incorporated inside a <script> tag in your php page your example should work should really work. The php would render the web addresses in to the script prior to it being delivered to the browser.

if you're attempting to load exterior javascript files with php inlcuded web addresses, you will have to set the correct headers and can include the php file just like you'd an ordinary .js file.

piece of content about this subject HERE

If javascript is within .php file you should use <?php echo $url ?> and when the file is .js you cannot use <?php ?>

It's not obvious in my experience what you're attempting to achieve. I suppose you're while using jQuery load() function, if so, you need to condition so.

You cannot load php throughout javascript execution since the php was already processes and made as HTML and delivered back towards the client. As PHP is processes around the server it's logical that you simply cannot run it around the client side.

You can obviously send an AJAX request towards the server that runs a particular php page and you'll have the ability to make use of the response while you please.