0

I need help with this problem, it keeps giving me this error in the developer tool even though the file is already in place.

It keep giving me this error:

Failed to load resource: the server responded with a status of 404 (Not Found)

Which I know that it is because it is not at the correct location but I have put it there correctly. Why do I keep getting this? Just now it was working fine but not sure what happen

Here is the location where I keep all the js file:

C:\xampp\htdocs\Evaluation\public\js

test.blade.php

<a class="word-export" href="javascript:void(0)">Export to Word (.doc)</a>

    <div class="word-content">
        <title>Test</title>
        <p>test somehting</p>
        <p>jadanjdwlb</p>
    </div>

<script src="js/signature_pad.js"></script>
<script src="js/test2.js"></script>

<script src="js/jquery.min.js"></script>
<script src="js/FileSaver.js"></script>
<script src="js/jquery.wordexport.js"></script>
<script>
    $('.word-export').click(function(events){
        $('.word-content').wordExport();
    });
</script>

It also gave me this error at my script and I know there shouldn't be anything wrong with it.

Uncaught ReferenceError: $ is not defined

3
  • Include jQuery before your script! As it should be first to be added while page loads and binds your events! Commented Dec 8, 2017 at 9:16
  • @DhavalMarthak I already done that but it just keep returning me error 404 I even remove the signature script and test script but still there Commented Dec 8, 2017 at 9:20
  • Try like: <script type="text/javascript" src="{{ URL::asset('js/test2.js') }}"></script> Commented Dec 8, 2017 at 9:21

2 Answers 2

1

Try like this:

<script type="text/javascript" src="{{ URL::asset('js/test2.js') }}"></script>

{{ URL::asset() }} is take path from your public directory!

If you created directory in assets in public then take {{ URL::asset('assets/') }}

Hope this helps you!

Sign up to request clarification or add additional context in comments.

1 Comment

If you created directory in assets in public then take {{ asset('assets/your_image_name') }}
1

There is a function available in laravel to load css and js and other assets. So to use that, put your css and js folders in public/assets folder. (You need to make assets folder)

Then load your files like this:

<script src="{{ asset('js/filename.js') }}"></script>

9 Comments

Include jQuery before your actual script!
yes, @DhavalMarthak is right. Put <script src="js/jquery.min.js"></script> to first of the other JS load.
I tried that as well but it doesn't work it, it just keep returning me error 404, just now it was working but after adding some text in it showed me the error again
So you can see 404 for all JS files in console?
Ohh I see thank you so much for your help and explaination, I look around and all I found for this error was because in wrong folder or location. Thank you all for helping me :)
|

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.