1

The title is confusing, so I'll elaborate..

I am working on a FaceBook box for my website, and when the comment is successfully posted, it displays an alert(). I am wanting to get rid of the alert() and instead, via jQuery, show and then fade out a div which will say the same thing as the alert() box.

Here's my code:

}, function (response) {
    if (response == 0) {
    alert("Your FaceBook status has not been updated.");
    } else {
        alert("Your FaceBook status has been updated.");
    }
    showLoader(false);
});
Charlie
  • 11,380
  • 19
  • 83
  • 138

2 Answers2

2

While you can replace the native alert() functionality, you can not achieve the blocking effect that the browser's native alert() provides.

I suggest something like this, or take a look at this SO question.

Community
  • 1
  • 1
simshaun
  • 21,263
  • 1
  • 57
  • 73
  • While I like this, I wanted to display a message over the text box and then have the message fade out. This way everything's inline. Do you know of any scripts like this? – Charlie Nov 30 '11 at 23:55
  • Yes, that seems to be what I'm looking for. I've set up a jsFiddle trying to accomplish this, can you figure out what I did wrong? http://jsfiddle.net/f8eDj/2/ – Charlie Dec 01 '11 at 01:19
  • It appears GitHub is preventing you from hotlinking the script like that, since its throwing a 403 forbidden. Try placing the block script on your own server instead. – simshaun Dec 01 '11 at 01:30
  • Looks like it's working. Now I would just put that code as a substitute for both the `alert()` functions above? – Charlie Dec 01 '11 at 01:36
  • Just to follow up on this, it was solved by calling this, `$('#container').block({ message: 'Your FaceBook status has been updated.', timeout: 10000, });`, when it meets the `if` requirements. – Charlie Dec 01 '11 at 03:55