Verified:

LATC Game profile

Member
1210

Mar 5th 2013, 22:43:57

WOW. So before it was just annoying because it wouldn't let you attack, but I got eff'ed by it on a grab today.

I typed in 990,000 jets because that was the break I calculated. I only had 883,000 jets though so it brought me to the confirmation screen saying it would send 883,000 jets. I noticed this was wrong so I went and bought 107,000 jets.

Go back to war room, enter country #, select PS, and enter 990,000 jets. I hit "Prepare Attack" and hit send right away on the confirmation screen because I knew for sure all my #'s were right this time. However right as I clicked 'send' I saw a glimpse of the screen and it said it was sending 883,000 jets. I failed the grab. Because all of my parameters were the same (same country #, same attack type, same jet amt), the second time it was still using the cached response from that first time when I didn't have enough jets.

It's such an easy fix for this problem (add a timestamp or random # as a param to the ajax call), can you PLEASE put it in? Takes 5 seconds!
Originally posted by Xinhuan:
Are you guys stupid or what?

h2orich Game profile

Member
2245

Mar 6th 2013, 3:36:49

I think it has to do with your cache not being able to refresh and it just loads the recent old cache. I have this problem. I always have to do a refresh F5 whenever there's updates on my country. It has been on going for a few weeks already for me.

LATC Game profile

Member
1210

Mar 6th 2013, 18:10:47

Yeah the probem is cache, but the fix is easy from a coding standpoint. I ran into/fixed this issue the first few days I started using AJAX calls on my own sites. It's literally a 5 second fix.
Originally posted by Xinhuan:
Are you guys stupid or what?

qzjul Game profile

Administrator
Game Development
10,264

Mar 7th 2013, 19:49:27

That's on your end, not on ours...?

I mean i can make the url unique, but that's just annoying
Finally did the signature thing.

LATC Game profile

Member
1210

Mar 7th 2013, 21:19:25

It happens on multiple browsers and is a problem with ajax calls in general. Multiple ppl have complained about similar problems on the boards (insufficient oil on first attempt to send and then not being able to attack after you buy oil unless you change value of military sent). As a web developer myself I've always considered this a developer responsibility and not a user-side issue. The user shouldn't have to change browsers, browser settings, or clear their cache repeatedly just so your code works properly.

As for a fix being annoying.. there are multiple one-line solutions:

Option 1: $.ajaxSetup({ cache: false });
Put this before all your jquery code and it prevents all ajax calls from being cached.

Option 2: If you only want that one ajax call to not be cached, add this parameter in function submit_attack_form():
uniqueId: (new Date()).getTime(),
Originally posted by Xinhuan:
Are you guys stupid or what?

qzjul Game profile

Administrator
Game Development
10,264

Mar 8th 2013, 0:08:55

hmk i'll take a peek at how it's done atm; pang wrote all the ajax attacking stuff, and though I had to review it for my back-end changes, I didn't fully go through how everything works...

most of the ajax I'd done in the past was a bunch of smaller little things.... not as familiar as i should be with it
Finally did the signature thing.