alioguzhan
alioguzhan

Reputation: 7917

Jquery- built-in confirm dialog

The following code is working correctly on localhost, but not on the server. I think 'confirm' is a kind of plugin function.

var ask = confirm('Are you sure');
if (ask){
    $('.loading_gif').show();
    $('.delete_link').hide();
    return true;
}
else{
    return false;
}

I want to use some built-in function to do same thing. How can I do this?

Thank you

Upvotes: 0

Views: 141

Answers (2)

Rick Su
Rick Su

Reputation: 16440

confirm should be standard JavaScript library function.

if it's not working on the server, check the following

  • check if jQuery script is included/loaded on the page
  • check if there are any error logged in console
  • try different browser, as JavaScript is client-side script, it has nothing to do with the server.

Upvotes: 1

Ohgodwhy
Ohgodwhy

Reputation: 50767

confirm is a javascript method to provide a prompt with an ok, or cancel button (browser dependent i think). the if(ask) statement checks to see if ask = true, when the cancel prompt's ok button is clicked, it returns true to the function, if cancel button is clickd, false returns. This is not a problem with the scope of this function.

Upvotes: 1

Related Questions