Page 1 of 1

successs of service

Posted: Thu Aug 07, 2014 2:21 pm
by deveu

str = JSON.stringify(dataarr);
localStorage.setItem('local_sync_up',str);
localStorage.setItem('local_table_name',table_name);
//b_number : localStorage.setItem("b_number");

Code: Select all

              restservice_sync_up.execute(); 

I am running this code with timer.
How may i get service success here


successs of service

Posted: Thu Aug 07, 2014 2:50 pm
by Evgene Karachevtsev

Hello Deveu,

You can add an event handler success on page restservice_sync_up, or add this feature during the service call, as it is shown here: https://getsatisfaction.com/apperyio/...


successs of service

Posted: Thu Aug 07, 2014 4:12 pm
by deveu

function str_prepare_send_to_server(table_name)
{ str = JSON.stringify(dataarr);
localStorage.setItem('local_sync_up',str);
localStorage.setItem('local_table_name',table_name);
//b_number : localStorage.setItem("b_number");

Code: Select all

              restservice_sync_up.execute({ 
                                  data:{ 
                                             sync_up:str, 
                                             table_name:table_name, 
                                             b_number : b_number 
                                        },  
                            success  : onSuccess 
              }); 

}

function onSuccess()
{
alert(1);
}

at login page i created service and execute the code with timer in main.js
but I need to move immediately another page

why service is not working


successs of service

Posted: Thu Aug 07, 2014 4:13 pm
by deveu

I never get alert
but ajax is ok to sending data but not getting success
$.ajax({
type: "POST",
url: 'http://dev.eu.com.au/rest-api-sync/sy...=?',
data: {
sync_up:str,
table_name:table_name,
b_number : b_number
},
success: function(data) {
alert(1);
//update_flag(table_name,results);
}
});


successs of service

Posted: Thu Aug 07, 2014 4:17 pm
by deveu

restservice_sync_up is created in login page
I want this service into another page
is this possible?


successs of service

Posted: Fri Aug 08, 2014 1:29 am
by Yurii Orishchuk

Hi Deveu,

You need know that "restservice_sync_up" is a datasource for certain service.

So you can add some other datasource of this service to other page and call it when you need.

Note: the name of the datasource should be diffrent from the first datasource name.

Regards.


successs of service

Posted: Fri Aug 08, 2014 2:53 am
by deveu

I need to execute with a Thread/Timer in a function when Page is noving one page to another


successs of service

Posted: Sun Aug 10, 2014 9:28 pm
by Yurii Orishchuk

Hi Deveu,

For this goal you can add for each page JS "page show" event handler with following code:

pre

//Adjust delay here. In ms.
var delay = 3000;

var onDelay = function(){
pageDatasource.execute({});
};
window.setTimeout(delay, onDelay);

/pre

See details: http://prntscr.com/4bj72q/direct

Regards.