jeudi 29 mai 2014

jQuery: determine the [server's] Document Root


Vote count:

0




in PHP you can do: $_SERVER['DOCUMENT_ROOT'] in combination to...ej:


PHP



<?php
$root = $_SERVER['DOCUMENT_ROOT'];
$path = '/example/directory/';
$file = 'some-file.html';

...etc
?>


How can I get the value of $_SERVER['DOCUMENT_ROOT'] in jQuery/JavaScript?


jQuery



//Example:
var root = ????;
var path = '/example/directory/';
var file = 'some-file.txt';

$("#example").load( root + path + file );


asked 45 secs ago

Omar

1,116





Aucun commentaire:

Enregistrer un commentaire