Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery, PHP form echo does not work

Tags:

jquery

php

Could you guys let me know what is wrong below, for some reason, when I click on the delete image, which is supposed to return the echo from dela.php file, but does not.

<script language="javascript" type="text/javascript">
    $(document).ready(function() {
        $('#del_form').ajaxForm({
            target: '#del',
            success: function() {
                $('#del').fadeIn(40000);
            }
        });
    });
</script>

<div>
    <form action="dela.php" id="del_form" method="post">
        <input type="image" src="del.gif" id="al_del" value="clicked" />
        click the image on the left
    </form>
</div>
<div id="del" style="background-color:#FFFF99; width:200px; height:100px;"></div>

// dela.php
<?
    if ($_POST['al_del']) {
        echo 'variable pass success';
    }
?>
like image 526
X10nD Avatar asked Sep 02 '26 22:09

X10nD


1 Answers

POST variables are based on input names, not ID's, afaik.

Also I'd usually go

if(isset($_POST['al_del']))

But that's a side bar.

like image 177
Psytronic Avatar answered Sep 05 '26 10:09

Psytronic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!