aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Should I just let a user hang till the server finishs the ajax request no matter how long it takes? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Should I just let a user hang till the server finishs the ajax request no matter how long it takes?" Watch "Should I just let a user hang till the server finishs the ajax request no matter how long it takes?" New topic
Author

Should I just let a user hang till the server finishs the ajax request no matter how long it takes?

Michael Hubele
Ranch Hand

Joined: Dec 17, 2005
Posts: 182
Hi

I am not really sure what to do in this situation. I have some jquery ui 1.7 tabs that are ajax enabled. Now when a tab is clicked it goes to my asp.net mvc controller action method. That then does whatever is needed and return a partial view(return some html).

Now I don't know why but sometimes my server hangs but then again I am guessing all servers hang since sometimes when I go to sites it take forever to load but if you do a refresh it loads up instantly and that's the same case with my site.

My site will load up a tab super fast for X number of times then all of a sudden a request will just hang and maybe like 15seconds later it will load up. Or if you just refresh the page it will go back and start loading them up super fast again.

The problem though is the request is sent to the server where it hangs. So I tried to setup a jquery timeout on all my ajax stuff and that calls an abort to the jquery ui tabs.

But it never works and I guess from what I gathered is because the request is on the server and abort won't stop stuff on the server. So if I look at firebug that request that hanged is still running.

Now this causes a huge problem for me since it screws up the entire page what is heavily ajax(disable javascript and the page is useless). Like if the user tries to click on say another tab they will most likely have to click 2 times to get it to load up. Another thing what happens is if that request ever finish hanging whatever tab they are on will merge with that tab. So sometimes one tab will have parts from all the other tabs.

So if it hangs and does not finish it really messes with the ajax tabs. I have no clue how to fix this.

So I am not sure what to do.

Let them hang for however long it takes the server to figure out how to finish that request(when a ajax request is made I disable all tabs. This is because if a person say loaded up a tab and did not let it finish and tried to go to another tab the same problem would occur with the tabs merging together). Or abort the request and have a screwed up tabs.

Great choices I got. Anyone got any better choices?

Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

Now I don't know why but sometimes my server hangs but then again I am guessing all servers hang since sometimes when I go to sites it take forever to load but if you do a refresh it loads up instantly and that's the same case with my site.

No, this is not normal. You need to find out why this is happening.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Michael Hubele
Ranch Hand

Joined: Dec 17, 2005
Posts: 182
Bear Bibeault wrote:
Now I don't know why but sometimes my server hangs but then again I am guessing all servers hang since sometimes when I go to sites it take forever to load but if you do a refresh it loads up instantly and that's the same case with my site.

No, this is not normal. You need to find out why this is happening.


where should I start. Seem like every site I go to has this. Like is it a code problem?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Should I just let a user hang till the server finishs the ajax request no matter how long it takes?