Jump to content

Ajax response receiving multiple times


ravi_k

Recommended Posts

Hi

I am using ajax to get the data received at server side .

In the below mentioned link,It is mentioned that:

The onreadystatechange event is triggered four times (1-4), one time for each change in the readyState.

https://www.w3schools.com/js/js_ajax_http_response.asp

 

In my case, some times the data is received 2 or 3 times when am sending it only once.

How to receive data only once.Please suggest

 

Thanks and Regards

Ravi K

 

Link to comment
Share on other sites

Your example doesn't illustrate your issue.

The data should generally only be received at stage 4.

1: server connection established
2: request received 
3: processing request 
4: request finished and response is ready

 

Do you have some specific code that is causing this issue for you?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...