Start New Discussion within our Web Development Community

i am new to ajax and not sure why this isnt working. when user click on link in index.php than ajax should run. in ajax it will open a cart_del_item.php file where the main code will run. this way the page wont reload every time user hit the link in index.php.

the problem is in jquery.js file. for some reason it wont open cart_del_item.php file.


<a href='cart.php?del_id=$image_id_db' id='linkx' name='linkx'>
            <img src='IMAGE/x.png' id='imgx' />



        type: 'POST',
        url: 'cart_del_item.php',    
        data: 'del_id_d=' + 2


    $del_id_p = $_POST['del_id_d'];

    $delete_query = mysql_query("DELETE FROM item_cart WHERE item_id = '$del_id_p'") or die(mysql_error());


in jquery.js i also trying putting this:

        //alert('ajax request complete - might be error ex value string has numbers?'); 
        //alert('ajax request success - Every thing works');

    the complete works but success doesnt work.

Don't know what version you are using, but the jQuery site states: "Deprecation Notice: The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callbacks are deprecated as of jQuery 1.8. To prepare your code for their eventual removal, use jqXHR.done(),, and jqXHR.always() instead."

This article has been dead for over six months. Start a new discussion instead.