0

I've a script referenced in List's view like :

<JSLink>~/retrieveAlarm.js</JSLink>

The first lines of the script show up an syntax error:

$(document).ready(function() {
    ExecuteOrDelayUntilScriptLoaded(getAlarms, "sp.js");
)};

enter image description here

What I've made wrong ?

Thanks.

  • First of all add jquery reference properly and then try using SP.SOD.executeFunc('sp.js', 'SP.ClientContext', getAlarms); and let me know this works or not. – Ganesh Sanap Nov 22 '18 at 8:54
  • @GaneshSanap Unfortunately does'nt works :s same error... – Francois Borgies Nov 22 '18 at 8:59
  • Then I think the problem is with your "$". check is there jquery file is loaded on your page or not? – Ganesh Sanap Nov 22 '18 at 9:02
  • Yes it's correctly loaded in the network tab – Francois Borgies Nov 22 '18 at 9:08
1

It seems that you have to add jQuery reference also into the JSLINK.

Your path should be like

<JSLink>Path_To_jQuery|~/retrieveAlarm.js</JSLink>

Other than this, the syntax seems to be fine.

  • i added it in the jslink but still not working :s in the network tab i see the JQuery was correctly loaded – Francois Borgies Nov 22 '18 at 9:07
  • 1
    If I leave only ExecuteOrDelayUntilScriptLoaded(getAlarms, "sp.js"); without $(document).ready()... it works well. – Francois Borgies Nov 22 '18 at 10:12
  • Yes, because we do not need jQuery for that. It is SP function. But you have used $(document).ready() that's why I proposed the answer. Great you solved!!!! – Aakash Maurya Nov 22 '18 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.