views:

27

answers:

2

so I put this alert() message inside the process() function just for testing. and it gets called every after the response has been made by the server. the process() is the function being called via onclick. what could be the problem and how to get away with this?

A: 

this is a sample code

arpan
A: 

Cross check your code and post it if possible. I would do a search for alert and see if that occurs twice.

schar
this is my js file..http://pastebin.com/m4392c09b
lenshark
So I understand your question as:You want the process() function to be called only once on a button click?
schar
I now saw where the problem is.. I setTimeout('process()', 1000); at the bottom of the handleServerResponse() funtion. :) thanks ^^
lenshark
Your function calls itself repeatedly on a timeout. SetTimeOut(Process(),1000) calls it and that would be showing you the alert message.If you want this to work only on a button click then take out the recursive calls.
schar