views:

33

answers:

3

I am currently working with an API, currently the sequence of events is I send an XML request to the api provider and it responds with a response in the format of some XML also, I was hoping there would be a way for me to detect when this reponse is sent back so I can show the user a loading message while the response is sent. Ideally I would like to do this in the form of a lightbox but I want to stay away from a full AJAX solution.

A: 

You can do this by checking the http response codes. And keep checking them in a loop while you play loading animation. Most people using a little circle that rotates

example: http://www.electrictoolbox.com/load-content-jquery-ajax-loading-image/

Thomas Winsnes
A: 

I can't get too specific without any info on your js framework, post/get etc.. but heres some pseudo code...

  1. place the html for the loading message in the page code but set display:none on it via css.

  2. when the button is clicked to fetch the data "show" the loading message (jquery: $("#loader").show()).

  3. after the data is loaded hide the loading message

Galen
I am using jquery, and I using POST to submit my XML to the API
sea_1987
A: 

I want to stay away from a full AJAX solution

Ajax would definitely be the way to go.

Back in the day (B.A., Before Ajax) we used to have the user post to an intermediary page that displayed a "working" graphic. The page also had a hidden javascript form that immediately submitted itself to the processing page. I still see some sites do this today.

webbiedave