D
D
Denis Ineshin2011-10-24 19:42:12
JavaScript
Denis Ineshin, 2011-10-24 19:42:12

Emulating Ajax responses?

Good afternoon.
The situation is as follows: the development of the front-end and back-end parts of the application are separated in time. Tell me the tools that could be used to emulate Ajax requests, responses, delays, errors, etc., so that you can test the interaction with the server, the work of preloaders, etc. in advance. tasks.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Konstantin Kitmanov, 2011-10-24
@IonDen

Wrap your work with Ajax in some kind of wrapper. Make two plugins for the wrapper: one will work for real, and the second will emulate asynchrony using setTimeout.
When the backend is ready, switch to the real one.
Keywords: Facade pattern, Dependency Injection

A
Anton_from_Amber, 2011-10-24
@Anton_from_Amber

Create a subdomain and write a rewrite rule that passes everything to one single script. Write a script that produces pseudo-random JSON data. And test to your heart's content. Send all requests to this subdomain (don't forget to make a DEFINE), keeping the get-request parameters.
In the script, it’s enough to make a block with a delay, a block with the generation of normal data and a nonsense generator that works every 10% (make a garbage constant and name it MurphyConst). Forward to the test!

Y
YourChief, 2011-10-24
@YourChief

how are ajax requests fundamentally different from regular http requests?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question