Javascript and Confirm

Discussion in 'Javascript' started by caroline.doidge@gmail.com, Oct 13, 2006.

  1. Guest

    This is a weird one and I am wondering if someone can help?

    I have a piece of Javascript
    function deleteRequest(searchID) {
    if (confirm('Are you sure?')){
    location = "index.php?spDB=inactive&searchID="+searchID;
    }
    }

    When the page gets reloaded, it runs a database query and something is
    made inactive.

    The problem is:
    When the confirm box appears, if I press OK quickly, the database query
    doesn't happen. If I wait 1 second and then press OK, it is fine and
    the query is run.

    Basically it appears that the time between the confirm javascript
    appearing and the time taken to press the Ok button affects the
    reloading of the page.

    Has anyone else had an issue like this?

    Cheers for anyones help.
    Caroline
     
    , Oct 13, 2006
    #1
    1. Advertising

  2. uoL Guest

    hi caroline,

    That's quite weird .. have you tried to use window.location =
    "something"; instead of location=''";
    is the only things that comes to my mind right now.

    take care,
    marcos.

    On Oct 13, 4:11 pm, wrote:
    > This is a weird one and I am wondering if someone can help?
    >
    > I have a piece of Javascript
    > function deleteRequest(searchID) {
    > if (confirm('Are you sure?')){
    > location = "index.php?spDB=inactive&searchID="+searchID;
    > }
    >
    > }When the page gets reloaded, it runs a database query and something is
    > made inactive.
    >
    > The problem is:
    > When the confirm box appears, if I press OK quickly, the database query
    > doesn't happen. If I wait 1 second and then press OK, it is fine and
    > the query is run.
    >
    > Basically it appears that the time between the confirm javascript
    > appearing and the time taken to press the Ok button affects the
    > reloading of the page.
    >
    > Has anyone else had an issue like this?
    >
    > Cheers for anyones help.
    > Caroline
     
    uoL, Oct 13, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jenet

    confirm method in javascript

    Jenet, Jul 16, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    426
    Kevin Spencer
    Jul 16, 2003
  2. Sudhir
    Replies:
    1
    Views:
    3,938
    Anatoly
    Nov 13, 2003
  3. Joe Finsterwald
    Replies:
    0
    Views:
    4,212
    Joe Finsterwald
    Dec 5, 2003
  4. =?Utf-8?B?cm9kY2hhcg==?=

    javascript confirm() and validation

    =?Utf-8?B?cm9kY2hhcg==?=, Nov 21, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    5,697
    S. Justin Gengo
    Nov 21, 2005
  5. YANP
    Replies:
    1
    Views:
    111
Loading...

Share This Page