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 511623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:14:08+00:00 2026-05-13T07:14:08+00:00

In view page: <script languge=javascript type=text/javascript> $(document).ready(function() { $(‘#delete’).click(function(e) {; e.preventDefault(); var parent =

  • 0

In view page:

<script languge="javascript" type="text/javascript">
  $(document).ready(function() {
    $('#delete').click(function(e) {;
        e.preventDefault();
        var parent = $(this).parent();
        mainParent=parent.parent();

        $.ajax({ 
            type: 'post',
            url: "<?= site_url('controller_Test/fnDelete') ?>",
            data: "id="+$(this).prev().text(),

            success: function() {
                mainParent.slideUp(0,function() {
                    mainParent.remove();
                });
            }

        });
        return false;
    });
});

Controller –controller_Test

function fnDelete(){
   $data['delete_me']=$_POST['id'];

    if (!empty($data['delete_me'])){
        $this->load->model('data_Model', '', TRUE);
        $this->properties->deleteRec($data['delete_me']);
        $this->output->set_output('works');
    } else {
        $this->output->set_output('dontwork');

    }
}

In this fnDelete should delete a row in the database. But its not deleting. but its removing that row from the view. Am using codeigniter.
Is there anything wrong with my code.?

  • 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-13T07:14:08+00:00Added an answer on May 13, 2026 at 7:14 am

    First, you’ve got a strange semicolon:

    $('#delete').click(function(e) {;
    

    Remove that from the end. Then, try your data like this instead:

    data: {"id":$(this).prev().text()}
    

    You may also want to handle the response within your callback, and echo out the results so you know whether the PHP succeeded, or failed.

    success: function(results) {
      if (results == "success") {
        /* remove associated elements */
      } else {
        alert("An error occurred.");
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written the following piece of code in my view page <script type=text/javascript>
Below is my example script: <li><a <?php if ($_GET['page']=='photos' && $_GET['view']!==projects||!==forsale) { echo (href=\#\
I have a form in my view page on submit a function in a
I want to add script files and css files to my php view page
I want to avoid script alert in my view page.That is when i users
In a view I have a script (javascript) that declares a variable after some
My view page has a Model which is represented by a List of Students.
I have a Create View page in my MVC3 project to create instances of
While rendering the view page, based on some condition in the controller action I
I have a view page that accepts a taxonomy term id as an argument

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.