[Seaside] Pharo 9/64 Bit & Seaside 3.4.4

Johan Brichau johan at inceptive.be
Fri Jul 30 06:50:17 UTC 2021


Hi Ian,

jQuery is not loaded, so you need to add jQuery to your application.
Take a look at references to JQDevelopmentLibrary or JQDeploymentLibrary to add it:

	| application |
	application := WAAdmin register: self asApplicationAt: 'javascript/jquery'.
	application preferenceAt: #scriptGeneratorClass put: JQScriptGenerator.
	application 
		addLibrary: JQDeploymentLibrary;
		addLibrary: JQAllFunctionalTestsLibrary.

Or, if you decide to host the jQuery source outside of the Smalltalk image (recommended for production!), you can add it in the updateRoot: method of your root component. For example:

updateRoot: aRoot
	super updateRoot: aRoot
	aRoot javascript resourceUrl: '/js-libs/jquery-3.3.1.min.js’.

Or, even better, use a CDN:

updateRoot: aRoot
	super updateRoot: aRoot
	aRoot javascript url: 'https://code.jquery.com/jquery-3.6.0.min.js’.


Let me know if it still does not work
Johan


> On 29 Jul 2021, at 20:30, Ian <icjohnson at protonmail.com> wrote:
> 
> Apologies,
> 
> I should finish this note with the actual error:
> 
> Uncaught ReferenceError: $ is not defined
>     onclick http://localhost:8080/todo:1 <http://localhost:8080/todo:1>
> 
> JQuery is thus shown not to be loading.
> 
> Thx!
> 
> Ian
> 
> Sent with ProtonMail <https://protonmail.com/> Secure Email.
> 
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Thursday, July 29th, 2021 at 2:26 PM, Ian <icjohnson at protonmail.com> wrote:
>> Hi All,
>> 
>> Newbie question here.
>> 
>> I am working through Chapter 21.6/21.6.1 of the Seaside book using both it and the Github version (Square Brackets Associates) as a cross reference for new material.
>> 
>> I am running into an issue where when adding the jQuery functionality as described in section 21.6.1, 'Adding an Effect,' I do not get the effect.  For some reason the code that is supposed to add jQuery to a page: 
>> 
>> renderHeadingOn: html
>>     | helpId |
>>     helpId := html nextId.
>>     (html heading)
>>         class: 'helplink';
>>         onClick: ((html jQuery new id: helpId)  ***** <<<------ HERE
>>             slideToggle: 1 seconds);
>>         with: self model title.
>>     (html div)
>>         id: helpId;
>>         class: 'help';
>>         style: 'display: none';
>>         with: 'The ToDo app enhanced with jQuery.'
>> 
>> Does not result in the rendered page getting the <link script element added to the head section nor in the <script> tag before the closing body tag (all according to firefox's developer tools as per:
>> 
>> <image.png>
>> 
>> Any help would be greatly appreciated.
>> 
>> Kind Regards,
>> 
>> Ian
>> 
>> Sent with ProtonMail <https://protonmail.com/> Secure Email.
>> 
> 
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/seaside/attachments/20210730/50170f40/attachment.html>


More information about the seaside mailing list