Reputation: 53850
I have this code inside http://www.mysite.local/js/site/functions.js
:
$.getScript('/js/common/jquery.jsonrpc.js',
$.jsonRPC.setup({
endPoint: '/api/accounts',
namespace: 'mynamespace'
})
);
It's supposed to run setup
method of jsonRPC plugin when it loads. But I receive error:
$.jsonRPC is undefined
http://www.mysite.local/js/site/functions.js
What's the problem and how can I solve it?
Upvotes: 0
Views: 2089
Reputation: 6720
try:
$.getScript('/js/common/jquery.jsonrpc.js', function() {
$.jsonRPC.setup({
endPoint: '/api/accounts',
namespace: 'mynamespace'
});
}
);
You need to wrap any callbacks with function () { }.
Upvotes: 2