I have created a html JS project.
I am calling AJAX function with URL but in the browser console, I see URL as Request URL: file:///C:/localhost:8080/allProducts
I want to call localhost:8080/allProducts
Code snippet:
$.ajax({
url: '/localhost:8080/allProducts',
....
..
2
Answers
You need to specify the protocol as in the following example:
http:///localhost:8080/allProducts
I would remove the
localhost:8080
portion of the URL. AssumingallProducts
is some sort of file in the root directory, I would puturl: /allProducts
.Then, if you end up pushing this into a production server it will look for
allProducts
at the root directory level, no matter the hostname.