I
I
iffkomc2015-10-28 11:26:59
JavaScript
iffkomc, 2015-10-28 11:26:59

Why does it give an error when trying to call a function from another script?

Decided to output the function to another .js file ('script2.js').
edb71c88e183426e989858e9746f1490.png
When calling a function from 'script.js', it throws an error.
6e8c1597e2174af596b57ecdf3977f49.pngf277969b3a5142538f32d3991f58fcfb.png
Explain how the browser combines all these js nicknames into one. And how to get rid of this problem?
If anything, the file with the function is connected earlier (!) than the file where this function is called.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2015-10-28
@Sanasol

in different scopes
Move the function from $().ready() to the global scope.

A
Alex Khizhniy, 2015-10-28
@mendler

window.displayUsers = function(){ ... }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question