Charles Rajendran Charles Rajendran - 4 months ago 15
jQuery Question

Javascript, Jquery works fine in localhost but not in the deployed site?

I just wrote a simple signup page, and validated it with pure javascript and jquery. I also used font-awesome icons to show status of the input value. It worked fine with all the user agents(I tested it with a chrome extension). but after putting the files to a server it is not working with any of the user agents.


issues :


  1. Some user agents not showing font awesome icons, but the scripts are working.

  2. In some user agents the icons as well as the scripts both are not working.




I don't no where the issue is.

<head>
<title>TicketIsle Login</title>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
<link rel="stylesheet" href="style.css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="validation.js"></script>
<script type="text/javascript" src="js/get_post.js"></script>
</head>


the above is how I put the scripts and style files.

Answer

if your page is in secure (https) some browsers dont allow you explicitly to download scripts or styles from non-secure (http) pages.

This syntax should be used to avoid this protocol issue:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

This is protocol agnostic i.e. it will work with both http and https.

Comments