cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Can one use jQuery inside Thingworx javascript service? How?

amitworx
1-Visitor

Can one use jQuery inside Thingworx javascript service? How?

I want to use javascript service to call a rest webservice asynchronously.

I think using jQuery to make this call will be better.

Has anyone worked on using it inside custom service?

Help/inputs are much appreciated.

Thanks and Regards,

Amit Teli

ACCEPTED SOLUTION

Accepted Solutions
PaiChung
22-Sapphire I
(To:amitworx)

I recommend you take our Web Based Training (WBT) there is a specific segment that covers an example of calling a REST service.

Within the Model, Things (ThingTemplates and ThingShapes) support Services. If you look in the Snippets Tab when creating a Service, you can scroll down to the Resources and find the Content Loader functions.

View solution in original post

6 REPLIES 6
PaiChung
22-Sapphire I
(To:amitworx)

You can just set the Service itself to run Asynchronous, you will not get a return value and if you need to make sure the service ran successfully, you will have to use something else like a timer event or a Property DataChange Event to check it ran successfully.

jquery itself I think is not supported server side, but i believe you can use client side (so in widgets)

Thank you for the quick reply.

I missed to consider it is on server side.

I want to use on server side only. So how do we handle these kind of situation in general?

1. Can we add server side js modules?

2. Can we call some webservice at all from our things?

Some pointers/reference will be very helpful

Thanks and Regards,

Amit

PaiChung
22-Sapphire I
(To:amitworx)

Server side is fully capable to do REST calls, there is a resource library called Content Loader Functions.

and like I mentioned, you can set a service to run Async if you need to.

This is really encouraging to know.

However I did not find any reference to the resource library while searching, before posting here.

Can you kindly provide some more details

Best Regards,

Amit

PaiChung
22-Sapphire I
(To:amitworx)

I recommend you take our Web Based Training (WBT) there is a specific segment that covers an example of calling a REST service.

Within the Model, Things (ThingTemplates and ThingShapes) support Services. If you look in the Snippets Tab when creating a Service, you can scroll down to the Resources and find the Content Loader functions.

Thank you very much.

I found them with your hints.

I think this will work for me.

Announcements


Top Tags