How to add the "Loading ... Wait ..." function?
I have a very simple table on my site that displays different urls. I have an input field where I can enter a URL and click Submit to add additional URLs.
However, I want to add an MD5 capture function to it using @ md5_file (); to grab the MD5 url and validate to make sure it should be MD5 before adding it to the database. However, it may take a few seconds to grab MD5 and compare it, so I would like to add some text like "Processing ... Wait ..." while it compares and then once it compares, I want this the text is gone.
I've never done this before, or at least about that, so I have no idea where to start. I'll go ahead and put javascript as a tag for this, since I assume it will be done from javascript, but I really don't know. I don't think this is possible with PHP, but again, I have no idea.
Any suggestions?
a source to share
I would use jQuery. Here's an example:
In your javascript code:
$.ajax({
type: "POST",
url: "some.php",
data: "name=John&location=Boston",
beforeSend: function() {
$('#message').fadeIn('');
},
success: function(msg){
$('#message').fadeOut('');
}
});
And your HTML
<div id="message">Processing...Please wait...</div>
Here is the link: http://api.jquery.com/jQuery.ajax/
a source to share
The way I did it, in the function where I do the AJAX message, I show the dialog (before the message) and after the ajax message, I hide it. Any modal dialog will do (I love jQuery as I often use a theme that comes with any site design I use). The problem is that sometimes the message doesn't take very long and it looks jittery. If so, a simple div in the middle of the page with the color that stands out is sufficient.
a source to share