Click here to Skip to main content
15,869,940 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have been developing a single page web application which works mainly on AJAX requests to web methods and DOM Manipulation based on responses of those AJAX requests.

I have been facing the strange problem than on a single ajax request, When i got a success response and

  success: function (response) {

}


chunk been called as well. but inside the success block a piece of chunk is got ignored. mean not called. and I tested it using alerts as well like below.

C#
success: function (response) {
alert(response); // it always called.


malfunctioning chunk
{
alert(""); // it called some times and sometimes not.
}
}



while to further extent. let me clear what problematic code is doing in actual.
Its just parsing the response.d using
$.parseJSON
and than traversing the array to create a HTML to be appended to another element.

STRANGE THING: that problematic code starts working always when i used the debugger of browser.


Anybody can give me idea of how to get rid of this ???
Posted
Comments
Nathan Minier 30-Oct-14 7:12am    
The most likely scenario is that some invalid JSON is contained in you AJAX response.
VICK 30-Oct-14 7:30am    
Well as I mentioned before that Problem went off if i use browser debugger. and I dont think that it makes the invalid JSON valid in that way.
Nathan Minier 30-Oct-14 7:33am    
No, I suspect that's coincidental.

...unless you have a debug implementation. Do you have a debug snooper for dumping to console that might accidentally be performing some object processing?
VICK 5-Nov-14 4:42am    
can u explain "debug snooper for dumping "??
Nathan Minier 5-Nov-14 6:48am    
Javascript can be used to create an IDE-stype runtime snooper, and some frameworks have it natively. It'd require some effort to setup, though, so if you had one you'd know.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900