Skip to main content
1-Visitor
January 28, 2016
Solved

Can one use jQuery inside Thingworx javascript service? How?

  • January 28, 2016
  • 6 replies
  • 4464 views

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

Best answer by PaiChung

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.

6 replies

22-Sapphire I
January 28, 2016

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)

amitworx1-VisitorAuthor
1-Visitor
January 28, 2016

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

22-Sapphire I
January 28, 2016

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.