events - Jquery is not showing results -


i need make jquery alert "are sure want delete" when user click on delete i've been trying lot didnt find solution

this deletemovie.php

<?php require('../system/initialize.php'); //load connection file ?>  <html><script src="../js/jquery.js" type="text/javascript"></script> <script type="text/javascript">     $(function () {         $(".delete").click(function () {             if ( !confirm('are sure want delete?') ) {                 return false;             } else {                 $.ajax({                     url: "deletemovie.php",                     data: {movie_id},                     type: 'get',                     async: false,                     success: function(result) {                         if( result.success ) {                             alert("you have deleted");                         }                     }                 })             }         })      ) </script> </html>  <?php $movie_id=$_get['movie_id']; $insert_user=mysql_query("delete  `movie` `movie_id` ={$movie_id}"); if($insert_user) { echo "deleted";} else { echo "error in registration".mysql_error(); } ?> 

of course, in list page did:

  echo "<a class='delete' href='deletemovie.php?movie_id={$movie_id}'>". delete .'</a><br/></td>'; 

you missing semicolons , brackets. , there should correction in data parameter of ajax call. use following code , work you

http://jsfiddle.net/n7v5w/

$(function () {     $(".delete").click(function () {         if (!confirm('are sure want delete?')) {             return false;         } else {             $.ajax({                 url: "deletemovie.php",                 data: {                     'movie_id': <id of movie>                 },                 type: 'get',                 async: false,                 success: function (result) {                     if (result.success) {                         alert("you have deleted");                     }                 }             });         }     }); }); 

note: have replace <id of movie> actual id of movie want delete


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -