andricoga
andricoga

Reputation: 87

why this javascript cannot function that we purpose in popup form

    </br>

s_foot"> *

use ajax.jquery as control event. like $("#save").click(function(){.....});

<script type="text/javascript">
var wp;
var posisi;
var pid;
var pname;
var pdate;

on this script i try to get value by element id and use POST as methode. here aksi.php code

    <?php
    //conect to database
    //get the value

 ($_POST['pname']);
        $ProductionDate = htmlspecialchars($_POST['pdate']);
        $save = mssql_query("Insert tblTrnProduct value('$ProductID', '$ProductName', '$WH', '$Posisi', '$ProductionDate')
        WHERE Posisi='$Posisi'");
        if($save){
        echo "sukses";
        }else{
        echo "error";
        }
        }
?>

on aksi.php no value were record. c'z when i use <?php print_r($_POST) ?> has a emty result. and of course when i run this in browser alwas say "ERROR..penyimpanan data GAGAL" .what the problem? please advice...with code sample will more appreciate..

Upvotes: 1

Views: 94

Answers (3)

JOE LEE
JOE LEE

Reputation: 1058

jsfiddle.net/

if you use jquery code , need load jquery (Frameworks & Extensions select box)

Upvotes: 1

plalx
plalx

Reputation: 43718

Your fiddle does work, you simply forgot to include jQuery. Have a look here http://jsfiddle.net/Rz2PZ/2/ . However, I expect that you probably included jQuery in your real project, so could it be that the exit function doesnt exist in your code?

Upvotes: 1

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324630

You failed to include jQuery in your jsFiddle. The $ is undefined error in your browser's console should have alerted you to this.

Upvotes: 1

Related Questions