Hi,
I am working on a project that I will try and explain.. we want to offer currency conversion on our payment page dependent on the origin of the users credit card. We have to connnect to a remote service sending some data and in return retrieve data back.
This AJAX operation is controlled by obtaining 6 digits worth of credit card info (enough to test the country of the card). If this data changes in anyway we should go through with the request to the remote service.
All this works just fine. Now I want to know if I have programmed this in the best way. The response generally takes a split second to return.. but there might be occasions when this is slower.
I had initially an onKeyPress event on the input text box but there was a slight delay in the update so angled my solution towards using a poll event instead with setTimeout logic that would trigger every 5 seconds checking if there is any change to the 6 digit credit card field.
Is this the best way I can do this? I am concerned that if my setTimeout runs every 5 seconds and the call to remote computer takes longer I'm going to get some strange events happening.
Thanks guys/gals
I am working on a project that I will try and explain.. we want to offer currency conversion on our payment page dependent on the origin of the users credit card. We have to connnect to a remote service sending some data and in return retrieve data back.
This AJAX operation is controlled by obtaining 6 digits worth of credit card info (enough to test the country of the card). If this data changes in anyway we should go through with the request to the remote service.
All this works just fine. Now I want to know if I have programmed this in the best way. The response generally takes a split second to return.. but there might be occasions when this is slower.
I had initially an onKeyPress event on the input text box but there was a slight delay in the update so angled my solution towards using a poll event instead with setTimeout logic that would trigger every 5 seconds checking if there is any change to the 6 digit credit card field.
Is this the best way I can do this? I am concerned that if my setTimeout runs every 5 seconds and the call to remote computer takes longer I'm going to get some strange events happening.
Thanks guys/gals