Page 1 of 1

How to invoke service from javascript

Posted: Thu Jun 05, 2014 2:55 am
by B510

Dear All,
I am new with this...

how to call service from javascript? ...

var isUserExists = data.length 0;
if(isUserExists)
alert("userExistsInDB");
else
// CALL MyDB_User_Create_Service

thanks


How to invoke service from javascript

Posted: Thu Jun 05, 2014 3:21 am
by Yurii Orishchuk

Hi Winanjaya.

At first you need to add service datasource on the page.
http://prntscr.com/3pshp6/direct

And then you can use following code:

precode

var isUserExists = data.length > 0;
if(isUserExists)
alert("userExistsInDB");
else
//Note you should replace "yourDatasourceService" with your datasource name.
yourDatasourceService.execute();

/code/pre

You also can pass additional parameters if you need inside this service execution if you need.

Regards.


How to invoke service from javascript

Posted: Thu Jul 17, 2014 9:54 pm
by Bikram Ray

perfect. just what I needed.


How to invoke service from javascript

Posted: Thu Jul 17, 2014 9:56 pm
by obullei

You are always welcome!


How to invoke service from javascript

Posted: Thu Aug 14, 2014 2:08 am
by Shubham Pareta

I am having problem. It says "Uncaught ReferenceError: restService1 is not defined" when i see pressing F12 debugger option this error is thrown up.

Please help asap. Thanks


How to invoke service from javascript

Posted: Thu Aug 14, 2014 2:33 am
by Yurii Orishchuk

Hi Shubham,

It means that you don't have this "restService1" service datasource on this page.

Please provide us screen shots of "data" tab of the page where you invoke this code. And the place where you have this JS code.

Regards.