Skip to content Skip to sidebar Skip to footer

Fetching In Javascript With Absolute Url And Relative Url

I have a script that I run on my local server and that fetches a php file (on the local server too). If I write the url to fetch as a relative path, I get the file without problems

Solution 1:

A URL that doesn't start with a scheme or with // is treated as a path (part of a relative URL).

From http://example.com/foo/, your URL resolves to http://example.com/foo/127.0.0.1:8000/mypath/myfile.php.

You almost certainly want:

var urlLocalServer = 'http://127.0.0.1:8000/mypath/myfile.php';

Post a Comment for "Fetching In Javascript With Absolute Url And Relative Url"