B510
Posts: 0
Joined: Wed Jun 04, 2014 2:17 pm

How to invoke service from javascript

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

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

How to invoke service from javascript

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.

Bikram Ray
Posts: 0
Joined: Wed May 22, 2013 5:52 pm

How to invoke service from javascript

perfect. just what I needed.

obullei
Posts: 0
Joined: Thu Jun 05, 2014 12:17 am

How to invoke service from javascript

You are always welcome!

Shubham Pareta
Posts: 0
Joined: Thu Aug 14, 2014 2:08 am

How to invoke service from javascript

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

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

How to invoke service from javascript

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.

Return to “Issues”