2

I've made a page to add data into a table (MySQL). Everything works fine on my computer and on the server when I'm connected to the local network. But when I'm trying to access the application from home, it seems that the path to CSS and JS files is not right! Here is how I use the link from office: http://server.domain.eu/moni/call_ans.html

And here is what link I use from home: https://server.domain.eu/moni/call_ans.html

Here is a part of my HTML code and how I include the JS and CSS file. I also use a PHP file, which is also linked wrong!

<head>
    <script src="jquery/jquery-ui-timepicker-addon.js"></script>
    <script src="jquery/jquery-ui-sliderAccess.js"></script>
<head>
  <link rel="stylesheet" href="jquery/jquery-ui-timepicker-addon.css">
  <link rel="stylesheet" href="jquery/jquery-ui-timepicker-addon.min.css">
</head>

<script>
....
        $(document).ready(function() {

            $("#techForm").submit(function(e) {
             var url = "call_ans.php";
        });
    });
....
</script>
</head>
5
  • what is the full path for JS and CSS files? Commented Jul 14, 2017 at 8:23
  • use two <head> might be problem and path may be Commented Jul 14, 2017 at 8:24
  • I don't think the 2 <head> is the problem. it is working as long as I'm at the office and I'm connected in the network Commented Jul 14, 2017 at 8:35
  • full path to js and css is \xampp\htdocs\jquery Commented Jul 14, 2017 at 8:37
  • on the server where is the location of you jquery folder in relationship to this file? is the jquery folder in the same folder? The same goes for the php file, to help you I think we need to better understand your directory structure. Also as a good practice, you should remove the duplicate head tags. Commented Jul 14, 2017 at 13:06

2 Answers 2

2

I don't know the full path of your JS/CSS but assuming that https://server.domain.eu/moni is the site root, I'd suggest adding the following under <head> tags:

<base href="https://server.domain.eu/moni">

There's typo in your file it should be like:

<!DOCTYPE html>
<html>
<head>
    <base href="https://server.domain.eu/moni">
    <script src="jquery/jquery-ui-timepicker-addon.js"></script>
    <script src="jquery/jquery-ui-sliderAccess.js"></script>
    <link rel="stylesheet" href="jquery/jquery-ui-timepicker-addon.css">
    <link rel="stylesheet" href="jquery/jquery-ui-timepicker-addon.min.css">
</head>

<body>
    <script>
        $(document).ready(function()
        {
            $("#techForm").submit(function(e)
            {
                var url = "call_ans.php";
            });
        });
    </script>

</body>

</html>
Sign up to request clarification or add additional context in comments.

Comments

0

Best solution is to add direct href to specific scripts or add ./ to location of files. Adding base should help but I/m not using that solution usually:

 <script src="./jquery/jquery-ui-timepicker-addon.js"></script>
 <script src="./jquery/jquery-ui-sliderAccess.js"></script>
 <link rel="stylesheet" href="./jquery/jquery-ui-timepicker-addon.css">
 <link rel="stylesheet" href="./jquery/jquery-ui-timepicker-addon.min.css">

Remember use dot slash to specific localization on server...

2 Comments

I cannot access the php file also! I think there is the same problem!
Add specific location for php file to have access to them. On serwer propably you have different access to files that on your pc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.