Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

153
Views
javascript script src error 404 Not Found

I'm doing something with .net core. I have some jquery code that I use in almost every page and I want to set that specific code in one file and reuse it in others. That common code has function that shoudl be called from others files. Exactly I have some function for my modal pop up. But I'm getting this error in browser "Failed to load resource: the server responded with a status of 404 (Not Found)" My question is similar as on this link, but replies didnt help me How to add jQuery in JS file

My code in VS

@*<script src="~/js/Event/OverViewNew.js"></script>

When I put all code in one file this works*@

$(document).ready(function () {
    var script = document.createElement('script');
    script.src = "~/wwwroot/js/Event/OverViewNew.js";  //doesn't work 
    //script.src = "~/js/Event/OverViewNew.js"; doesnt work 
    script.type = 'text/javascript';
    document.head.appendChild(script);
    //document.getElementsByTagName('head')[0].appendChild(script);

    var script2 = document.createElement('script');
    script2.src = '~/wwwroot/js/Helper/Modal.js'; //doesn't work
    //script2.src = '~/js/Helper/Modal.js';  //doesn't work
    script2.type = 'text/javascript';
    document.head.appendChild(script2);
    //document.getElementsByTagName('head')[1].appendChild(script2);
});
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!