Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4271478
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:26:52+00:00 2026-05-21T07:26:52+00:00

Why isn’t the function with fadeOut ever being reached? Every time the function runs

  • 0

Why isn’t the function with fadeOut ever being reached? Every time the function runs it refreshes the page instead of using AJAX.

<script type="text/javascript">


function deleterow(id){
if (confirm('Are you sure want to delete?')) {
$.post('delete.php', {id: +id, ajax: 'true' },
function(){
$("#row_"+id).fadeOut("slow");
});
}
}

</script>

Here is the html output by php:

<button onclick="deleterow('.$entry['rowid'].')" class="fg-button fg-button-icon-left ui-state-default ui-corner-all"><span class="ui-icon ui-icon-trash"></span></button>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:26:53+00:00Added an answer on May 21, 2026 at 7:26 am

    Its hard to say for certain without seeing the code/html that invokes the function but I assume this is attached to an onclick handler somehow. Therefore if you do not prevent the default action (following the href of the a tag) its going to refresh the page. You need to return false from the handler function or callevent.preventDefault() from it.

    I would use this markup instead:

    <button 
      value="$entry['rowid']"
      class="fg-delete fg-button fg-button-icon-left ui-state-default ui-corner-all">
      <span class="ui-icon ui-icon-trash"></span>
    </button>
    

    By encoding the rowid in the dom (in this case as value) we can access it in our functions without having to hard code it into the function call and keep the handler unobtrusive.

    // pulling this into a full definition for clarity
    // you could of course just use an anon function inside you $.click call
    function handleDelete(event){
       event.preventDefault();
       var $this = $(this);
       var rowId = $this.val();
       deleterow(rowId);
       return false;
    }
    
    
    $('button.fg-delete').click(handleDelete);
    

    Demo: http://jsfiddle.net/eBa7v/1/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Isn't there some way to combine two images together using the xOr operator? I
Isn't the use of delegates to help with some asynchronous cases? I tried the
This isn't legal: public class MyBaseClass { public MyBaseClass() {} public MyBaseClass(object arg) {}
This isn't a holy war, this isn't a question of which is better. What
Why isn't Visual Studio 2005 generating a serialization setting when I set the project
Why isn't Collection.remove(Object o) generic? Seems like Collection<E> could have boolean remove(E o); Then,
Why isn't this project maintained anymore? I love this app, however not updating it
This isn't as malicious as it sounds, I want to get the current size
Why isn't there a logout button? Why no list of websites you're logged into?
Sharepoint isn't the speediest of server applications, and I've read about a few tips

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.