Ajax calls and rework

Ajax calls and rework

Hi every one, thanks for your time :)

I've started using a framework which consists of a JQuery front end and ASPX web methods(JSON), so far I'm really enjoying it but it is becoming painful for agile projects.

My biggest issue is pretty much reworking the success responses each time and it can get messy, for example:

On window open:
Get person info
Get company info
Validate permissions
Show the window once all 3 are complete.

Now my boss comes back to me and he wants to add 2 more conditions before the window shows, I then have to rework the chain each time and I just feel like there has to be an easier way, I've typically been a webforms developer so a little change slots in fine.

Even a good article on how to approach this correctly would be great.

Currently I'm chaining it like so

GetPersonInfo()
OnSuccessGetPersonInfo(d) { GetCompanyInfo(); }
OnSuccessGetCompanyInfo(d) { GetPermissionInfo(); }
OnSuccessGetPermissionInfo(d) { ShowWindow(); }

Based on the above example.

Thanks a bunch :)